comparison of usage stats of a selected word among all poets #471
This commit is contained in:
parent
f6cec461b2
commit
4ecf35125b
@ -13,6 +13,7 @@ using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Org.BouncyCastle.Asn1.Cmp;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Services.Implementation;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
@ -485,6 +486,7 @@ namespace GanjooRazor.Pages
|
||||
return new BadRequestObjectResult(JsonConvert.DeserializeObject<string>(await wordCountsResponse.Content.ReadAsStringAsync()));
|
||||
}
|
||||
var wordCounts = JsonConvert.DeserializeObject<PoetOrCatWordStat[]>(await wordCountsResponse.Content.ReadAsStringAsync());
|
||||
string countStr = wordCountsResponse.Headers.GetValues("items-count").FirstOrDefault();
|
||||
|
||||
return new PartialViewResult()
|
||||
{
|
||||
@ -496,6 +498,7 @@ namespace GanjooRazor.Pages
|
||||
Term = term,
|
||||
WordStats = wordCounts,
|
||||
Whole = catId == 0 && poetId == 0,
|
||||
TotalCount = string.IsNullOrEmpty(countStr) ? 0 : int.Parse(countStr)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -2,11 +2,13 @@
|
||||
@using System.Globalization
|
||||
@using DNTPersianUtils.Core
|
||||
|
||||
<p>
|
||||
«@Model.Term» در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.TotalCount) بار در @Model.SectionName ظاهر شده است.
|
||||
</p>
|
||||
|
||||
|
||||
@if (Model.WordStats.Length > 0)
|
||||
{
|
||||
<p>
|
||||
«@Model.Term» در مجموع @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats.Sum(w => w.Count)) بار طبق جدول زیر در @Model.SectionName ظاهر شده است:
|
||||
</p>
|
||||
<table class="stats" id="words-stats">
|
||||
<thead>
|
||||
<tr class="h">
|
||||
|
||||
@ -8,6 +8,7 @@ namespace GanjooRazor.Pages
|
||||
public string Term { get; set; }
|
||||
public PoetOrCatWordStat[] WordStats { get; set; }
|
||||
public bool Whole { get; set; }
|
||||
public int TotalCount { get; set; }
|
||||
public string SectionName
|
||||
{
|
||||
get
|
||||
|
||||
Loading…
Reference in New Issue
Block a user