#268 updating GanjoorMetre.VerseCount (deliberately with couplets count) to use in displaying list of metres

This commit is contained in:
Hamid Reza Mohammadi 2021-12-29 20:37:59 +03:30
parent 9be6b70cde
commit 21d98519b9
3 changed files with 11 additions and 5 deletions

View File

@ -35,7 +35,7 @@
public string Description { get; set; }
/// <summary>
/// Total Verse Count
/// Total Verse Count (its actually couplet count)
/// </summary>
public int VerseCount { get; set; }
}

View File

@ -5460,7 +5460,7 @@
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorMetre.VerseCount">
<summary>
Total Verse Count
Total Verse Count (its actually couplet count)
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.GanjoorNumbering">

View File

@ -212,9 +212,13 @@ namespace RMuseum.Services.Implementation
htmlText += $"<tr>{Environment.NewLine}";
htmlText += $"<td class=\"c1\">{(i + 1).ToPersianNumbers()}</td>{Environment.NewLine}";
string rhythm = rhythmsCoupletCounts[i].GanjoorMetreId == null ? "وزنیابی نشده" :
$"<a href=\"/vazn/?v={Uri.EscapeDataString(rhythms.Where(r => r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single().Rhythm)}\">{rhythms.Where(r => r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single().Rhythm}</a>";
htmlText += $"<td class=\"c2\">{rhythm}</td>{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 ? "وزنیابی نشده" :
$"<a href=\"/vazn/?v={Uri.EscapeDataString(rhythm.Rhythm)}\">{rhythms.Where(r => r.Id == rhythmsCoupletCounts[i].GanjoorMetreId).Single().Rhythm}</a>";
htmlText += $"<td class=\"c2\">{rhythmName}</td>{Environment.NewLine}";
htmlText += $"<td class=\"c3\">{LanguageUtils.FormatMoney(rhythmsCoupletCounts[i].Count)}</td>{Environment.NewLine}";
htmlText += $"<td class=\"c4\">{(rhythmsCoupletCounts[i].Count * 100.0 / sumRhythmsCouplets).ToString("N2", new CultureInfo("fa-IR")).ToPersianNumbers()}</td>{Environment.NewLine}";
@ -222,6 +226,8 @@ namespace RMuseum.Services.Implementation
}
htmlText += $"</table>{Environment.NewLine}";
await context.SaveChangesAsync();//store rhythm[s].VerseCount
await _UpdatePageHtmlText(context, editingUserId, dbPage, "به روزرسانی خودکار صفحهٔ آمار وزنها", htmlText);
foreach (var poetInfo in poetsCoupletCounts)