From 21d98519b9981fc06b44e96479cc5db2b897c47e Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Wed, 29 Dec 2021 20:37:59 +0330 Subject: [PATCH] #268 updating GanjoorMetre.VerseCount (deliberately with couplets count) to use in displaying list of metres --- RMuseum/Models/Ganjoor/GanjoorMetre.cs | 2 +- RMuseum/RMuseum.xml | 2 +- .../GanjoorService-Partials/GanjoorService-Stats.cs | 12 +++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/RMuseum/Models/Ganjoor/GanjoorMetre.cs b/RMuseum/Models/Ganjoor/GanjoorMetre.cs index e4a0c739..b7244d01 100644 --- a/RMuseum/Models/Ganjoor/GanjoorMetre.cs +++ b/RMuseum/Models/Ganjoor/GanjoorMetre.cs @@ -35,7 +35,7 @@ public string Description { get; set; } /// - /// Total Verse Count + /// Total Verse Count (its actually couplet count) /// public int VerseCount { get; set; } } diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 93a949a0..8dd678a1 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -5460,7 +5460,7 @@ - Total Verse Count + Total Verse Count (its actually couplet count) diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Stats.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Stats.cs index b8b5d0e0..053a5853 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Stats.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-Stats.cs @@ -212,9 +212,13 @@ namespace RMuseum.Services.Implementation htmlText += $"{Environment.NewLine}"; htmlText += $"{(i + 1).ToPersianNumbers()}{Environment.NewLine}"; - string rhythm = rhythmsCoupletCounts[i].GanjoorMetreId == null ? "وزنیابی نشده" : - $" r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single().Rhythm)}\">{rhythms.Where(r => r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single().Rhythm}"; - htmlText += $"{rhythm}{Environment.NewLine}"; + var rhythm = rhythms.Where(r => r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single(); + rhythm.VerseCount = rhythmsCoupletCounts.Count; + context.Update(rhythm); + + string rhythmName = rhythmsCoupletCounts[i].GanjoorMetreId == null ? "وزنیابی نشده" : + $"{rhythms.Where(r => r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single().Rhythm}"; + htmlText += $"{rhythmName}{Environment.NewLine}"; htmlText += $"{LanguageUtils.FormatMoney(rhythmsCoupletCounts[i].Count)}{Environment.NewLine}"; htmlText += $"{(rhythmsCoupletCounts[i].Count * 100.0 / sumRhythmsCouplets).ToString("N2", new CultureInfo("fa-IR")).ToPersianNumbers()}{Environment.NewLine}"; @@ -222,6 +226,8 @@ namespace RMuseum.Services.Implementation } htmlText += $"{Environment.NewLine}"; + await context.SaveChangesAsync();//store rhythm[s].VerseCount + await _UpdatePageHtmlText(context, editingUserId, dbPage, "به روزرسانی خودکار صفحهٔ آمار وزنها", htmlText); foreach (var poetInfo in poetsCoupletCounts)