Skip to content

Commit

Permalink
comparison of usage stats of a selected word among all poets #471
Browse files Browse the repository at this point in the history
  • Loading branch information
hrmoh committed Mar 8, 2025
1 parent 6d8d904 commit 4755601
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion GanjooRazor/Pages/Search.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<div class="expandable-content" id="expandableContent">
<div id="wordcounts-placeholder">
<a href="javascript:loadWordCountsByPoet('@Model.Query', @Model.PoetId, @Model.CatId)" id="load-word-counts" class="pagebutton comments-link">
مشاهدهٔ بسامد واژگان «@Model.Query» به تفکیک سخنور
مشاهدهٔ بسامد واژگان «@Model.Query» به تفکیک بخش
<svg class="noindent-info-button" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#5f6368"><g><rect fill="none" height="24" width="24" /></g><g><g><g><path d="M7.5,4C5.57,4,4,5.57,4,7.5S5.57,11,7.5,11S11,9.43,11,7.5S9.43,4,7.5,4z M7.5,9C6.67,9,6,8.33,6,7.5S6.67,6,7.5,6 S9,6.67,9,7.5S8.33,9,7.5,9z M16.5,13c-1.93,0-3.5,1.57-3.5,3.5s1.57,3.5,3.5,3.5s3.5-1.57,3.5-3.5S18.43,13,16.5,13z M16.5,18 c-0.83,0-1.5-0.67-1.5-1.5s0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5S17.33,18,16.5,18z M5.41,20L4,18.59L18.59,4L20,5.41L5.41,20z" /></g></g></g></svg>
</a>
</div>
Expand Down
3 changes: 2 additions & 1 deletion GanjooRazor/Pages/Search.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ public async Task<ActionResult> OnGetWordCountsByPoetAsync(string term, int poet
Model = new _WordCountsByPoetPartialModel()
{
Term = term,
WordStats = wordCounts
WordStats = wordCounts,
Whole = catId == 0 && poetId == 0,
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@if (Model.WordStats.Length > 0)
{
<p>
«@Model.Term» در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار در گنجور ظاهر شده است که سهم هر سخنور در جدول زیر مشخص شده است.
«@Model.Term» در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار طبق جدول زیر در @Model.SectionName ظاهر شده است:
</p>
<table class="stats" id="words-stats">
<thead>
Expand All @@ -23,7 +23,7 @@
{
<tr class="e">
<td class="c1">@((i + 1).ToPersianNumbers())</td>
<td class="c2"><a href="/[email protected]&[email protected][i].PoetId">@Model.WordStats[i].Name</a></td>
<td class="c2"><a href="/[email protected]&[email protected][i].PoetId&[email protected][i].CatId">@Model.WordStats[i].Name</a></td>
<td class="c3">@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats[i].Count)</td>
@if (Model.WordStats[i].TotalWordCount == 0)
{
Expand All @@ -40,7 +40,7 @@
{
<tr>
<td class="c1">@((i + 1).ToPersianNumbers())</td>
<td class="c2"><a href="/[email protected]&[email protected][i].PoetId">@Model.WordStats[i].Name</a></td>
<td class="c2"><a href="/[email protected]&[email protected][i].PoetId&[email protected][i].CatId">@Model.WordStats[i].Name</a></td>
<td class="c3">@RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats[i].Count)</td>
@if (Model.WordStats[i].TotalWordCount == 0)
{
Expand Down
10 changes: 9 additions & 1 deletion GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.RazorPages;
using RMuseum.Models.Ganjoor.ViewModels;

namespace GanjooRazor.Pages
Expand All @@ -7,5 +7,13 @@ public class _WordCountsByPoetPartialModel : PageModel
{
public string Term { get; set; }
public PoetOrCatWordStat[] WordStats { get; set; }
public bool Whole { get; set; }
public string SectionName
{
get
{
return Whole ? "گنجور" : "این بخش";
}
}
}
}

0 comments on commit 4755601

Please sign in to comment.