diff --git a/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml b/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml index e4ac465a..565e1b26 100644 --- a/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml +++ b/GanjooRazor/Pages/_WordCountsByPoetPartial.cshtml @@ -23,7 +23,7 @@ { @((i + 1).ToPersianNumbers()) - @Model.WordStats[i].Name + @Model.WordStats[i].Name @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats[i].Count) @if (Model.WordStats[i].TotalWordCount == 0) { @@ -40,7 +40,7 @@ { @((i + 1).ToPersianNumbers()) - @Model.WordStats[i].Name + @Model.WordStats[i].Name @RMuseum.Services.Implementation.LanguageUtils.FormatMoney(Model.WordStats[i].Count) @if (Model.WordStats[i].TotalWordCount == 0) { diff --git a/RMuseum/Controllers/GanjoorController.cs b/RMuseum/Controllers/GanjoorController.cs index 2d1afa76..5c9737ff 100644 --- a/RMuseum/Controllers/GanjoorController.cs +++ b/RMuseum/Controllers/GanjoorController.cs @@ -4373,16 +4373,17 @@ namespace RMuseum.Controllers /// /// /// + /// /// [HttpGet] - [Route("wordcounts/bypoet")] + [Route("wordcounts/bycat")] [AllowAnonymous] [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable))] [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] - public async Task GetCategoryWordCountsByPoetsAsync(string term, [FromQuery] PagingParameterModel paging) + public async Task GetCategoryWordCountsByPoetsAsync(string term, [FromQuery] PagingParameterModel paging, int? parentCatId) { - var pagedResult = await _ganjoorService.GetCategoryWordCountsByPoetsAsync(term, paging); + var pagedResult = await _ganjoorService.GetCategoryWordCountsBySubCatsAsync(term, paging, parentCatId); if (!string.IsNullOrEmpty(pagedResult.ExceptionString)) return BadRequest(pagedResult.ExceptionString); diff --git a/RMuseum/Models/Ganjoor/ViewModels/PoetOrCatWordStat.cs b/RMuseum/Models/Ganjoor/ViewModels/PoetOrCatWordStat.cs index c51c672d..16ebdcd9 100644 --- a/RMuseum/Models/Ganjoor/ViewModels/PoetOrCatWordStat.cs +++ b/RMuseum/Models/Ganjoor/ViewModels/PoetOrCatWordStat.cs @@ -2,7 +2,8 @@ { public class PoetOrCatWordStat { - public int Id { get; set; } + public int CatId { get; set; } + public int PoetId { get; set; } public string Name { get; set; } public int Count { get; set; } public int RowNmbrInCat { get; set; } diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index bf2e0751..cafcafe9 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -2345,12 +2345,13 @@ - + comparison of word counts for poets + @@ -17467,12 +17468,13 @@ - + comparison of word counts for poets + @@ -19256,12 +19258,13 @@ - + - comparison of word counts for poets + comparison of word counts for poets ot subcats + diff --git a/RMuseum/Services/IGanjoorService.cs b/RMuseum/Services/IGanjoorService.cs index 09d0170b..303f823d 100644 --- a/RMuseum/Services/IGanjoorService.cs +++ b/RMuseum/Services/IGanjoorService.cs @@ -1506,8 +1506,9 @@ namespace RMuseum.Services /// /// /// + /// /// - Task> GetCategoryWordCountsByPoetsAsync(string term, PagingParameterModel paging); + Task> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId); /// /// tajik import from sqlite diff --git a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs index 3bb253b4..99a239c8 100644 --- a/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs +++ b/RMuseum/Services/Implementation/GanjoorService-Partials/GanjoorService-CategoryWordCounts.cs @@ -68,12 +68,13 @@ namespace RMuseum.Services.Implementation } /// - /// comparison of word counts for poets + /// comparison of word counts for poets ot subcats /// /// /// + /// /// - public async Task> GetCategoryWordCountsByPoetsAsync(string term, PagingParameterModel paging) + public async Task> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId) { try { @@ -81,12 +82,13 @@ namespace RMuseum.Services.Implementation from cwd in _context.CategoryWordCounts join catsum in _context.CategoryWordCountSummaries on cwd.CatId equals catsum.CatId join cat in _context.GanjoorCategories on cwd.CatId equals cat.Id - where cat.ParentId == null && cwd.Word == term + where cat.ParentId == parentCatId && cwd.Word == term orderby cwd.Count descending select new PoetOrCatWordStat() { - Id = cat.PoetId, + CatId = cat.Id, + PoetId = cat.PoetId, Name = cat.Title, Count = cwd.Count, RowNmbrInCat = cwd.RowNmbrInCat,