stats for poems couplet counts in categories

#464
This commit is contained in:
Hamid Reza Mohammadi 2025-01-28 15:46:36 +03:30
parent 0ce38bef9d
commit 684bb0e29d
4 changed files with 53 additions and 1 deletions

View File

@ -323,6 +323,8 @@
<p><a role="button" onclick="rebuildTajikSitemap()" class="actionlink" title="بازسازی نقشهٔ سایت">بازسازی نقشهٔ سایت تاجیکی</a></p>
<p><a role="button" onclick="refillCoupletCounts()" class="actionlink">بازشماری تعداد ابیات قطعات</a></p>
<p><a role="button" onclick="rebuildStats()" class="actionlink" title="بازسازی صفحات آمار و اوزان عروضی">بازسازی صفحات آمار و اوزان عروضی</a></p>
<p><a role="button" onclick="rebuildRelatedPages()" class="actionlink" title="بازسازی صفحات استقبالها">بازسازی صفحات استقبالها</a></p>

View File

@ -340,6 +340,25 @@ namespace GanjooRazor.Areas.Admin.Pages
}
public async Task<IActionResult> OnPostRefillSectionsCoupletCountsAsync()
{
using (HttpClient secureClient = new HttpClient())
{
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
{
HttpResponseMessage response = await secureClient.PostAsync($"{APIRoot.Url}/api/ganjoor/fillsectioncoupletcounts", null);
if (!response.IsSuccessStatusCode)
{
return BadRequest(JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync()));
}
return new OkObjectResult(true);
}
}
return new OkObjectResult(false);
}
public async Task<IActionResult> OnPostRebuildRelatedPagesAsync()
{

View File

@ -181,6 +181,27 @@
});
}
function refillCoupletCounts() {
if (!confirm('آیا از بازشماری تعداد ابیات قطعات اطمینان دارید؟'))
return;
var url = '?handler=RefillSectionsCoupletCounts';
$.ajax({
type: "POST",
url: url,
error: function() {
alert('خطا رخ داد.')
},
success: function() {
alert('فرایند بازشماری تعداد ابیات قطعات شروع شد.')
},
});
}
function rebuildRelatedPages() {
if (!confirm('آیا از بازسازی محتوای صفحات استقبال‌ها اطمینان دارید؟'))
return;

View File

@ -415,7 +415,7 @@
<small><i class="notranslate pageicons mouse-icon"></i> با انتخاب متن و لمس متن انتخابی می‌توانید آن را در لغتنامهٔ دهخدا جستجو کنید.</small>
</p>
@if (Model.GanjoorPage.Poem.Sections.Where(s => s.SectionType == RMuseum.Models.Ganjoor.PoemSectionType.WholePoem && s.GanjoorMetre != null).Any() || !string.IsNullOrEmpty(Model.GanjoorPage.Poem.OldTag) || !string.IsNullOrEmpty(Model.GanjoorPage.Poem.SourceName))
@if (Model.GanjoorPage.Poem.Sections.Where(s => s.SectionType == RMuseum.Models.Ganjoor.PoemSectionType.WholePoem).Any() || !string.IsNullOrEmpty(Model.GanjoorPage.Poem.OldTag) || !string.IsNullOrEmpty(Model.GanjoorPage.Poem.SourceName))
{
<table>
@if (!Model.MutiPartPoemPage)
@ -476,6 +476,16 @@
</tr>
}
<tr>
<td>
تعداد ابیات:
</td>
<td>
@Model.GanjoorPage.Poem.Sections.Where(s => s.SectionType == RMuseum.Models.Ganjoor.PoemSectionType.WholePoem).Sum(s => s.CoupletsCount).ToPersianNumbers()
</td>
</tr>
</table>
}