comparison of usage stats of a selected word among all poets #471

This commit is contained in:
Hamid Reza Mohammadi 2025-03-08 13:24:59 +03:30
parent a121e148e2
commit 842372d5fe
4 changed files with 20 additions and 9 deletions

View File

@ -4373,7 +4373,8 @@ namespace RMuseum.Controllers
/// </summary>
/// <param name="term"></param>
/// <param name="paging"></param>
/// <param name="parentCatId"></param>
/// <param name="catId">can be null or can be extracted from poetId</param>
/// <param name="poetId">is not necessary unless you mean a specific poet and do not provide catId</param>
/// <returns></returns>
[HttpGet]
[Route("wordcounts/bycat")]
@ -4381,9 +4382,9 @@ namespace RMuseum.Controllers
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<PoetOrCatWordStat>))]
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
public async Task<IActionResult> GetCategoryWordCountsByPoetsAsync(string term, [FromQuery] PagingParameterModel paging, int? parentCatId)
public async Task<IActionResult> GetCategoryWordCountsByPoetsAsync(string term, [FromQuery] PagingParameterModel paging, int? catId, int? poetId)
{
var pagedResult = await _ganjoorService.GetCategoryWordCountsBySubCatsAsync(term, paging, parentCatId);
var pagedResult = await _ganjoorService.GetCategoryWordCountsBySubCatsAsync(term, paging, catId, poetId);
if (!string.IsNullOrEmpty(pagedResult.ExceptionString))
return BadRequest(pagedResult.ExceptionString);

View File

@ -2345,13 +2345,14 @@
<param name="catId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetCategoryWordCountsByPoetsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Int32})">
<member name="M:RMuseum.Controllers.GanjoorController.GetCategoryWordCountsByPoetsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Int32},System.Nullable{System.Int32})">
<summary>
comparison of word counts for poets
</summary>
<param name="term"></param>
<param name="paging"></param>
<param name="parentCatId"></param>
<param name="catId">can be null or can be extracted from poetId</param>
<param name="poetId">is not necessary unless you mean a specific poet and do not provide catId</param>
<returns></returns>
</member>
<member name="M:RMuseum.Controllers.GanjoorController.GetTajikPoetsAsync">
@ -17468,13 +17469,14 @@
<param name="catId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetCategoryWordCountsBySubCatsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Int32})">
<member name="M:RMuseum.Services.IGanjoorService.GetCategoryWordCountsBySubCatsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Int32},System.Nullable{System.Int32})">
<summary>
comparison of word counts for poets
</summary>
<param name="term"></param>
<param name="paging"></param>
<param name="parentCatId"></param>
<param name="poetId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.TajikImportFromSqlite(System.Int32,System.String)">
@ -19258,13 +19260,14 @@
<param name="catId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetCategoryWordCountsBySubCatsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Int32})">
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetCategoryWordCountsBySubCatsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Int32},System.Nullable{System.Int32})">
<summary>
comparison of word counts for poets ot subcats
</summary>
<param name="term"></param>
<param name="paging"></param>
<param name="parentCatId"></param>
<param name="poetId"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.BuildCategoryWordCountsAsync(System.Boolean,System.Int32)">

View File

@ -1507,8 +1507,9 @@ namespace RMuseum.Services
/// <param name="term"></param>
/// <param name="paging"></param>
/// <param name="parentCatId"></param>
/// <param name="poetId"></param>
/// <returns></returns>
Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId);
Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId, int? poetId);
/// <summary>
/// tajik import from sqlite

View File

@ -73,11 +73,17 @@ namespace RMuseum.Services.Implementation
/// <param name="term"></param>
/// <param name="paging"></param>
/// <param name="parentCatId"></param>
/// <param name="poetId"></param>
/// <returns></returns>
public async Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId)
public async Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId, int? poetId)
{
try
{
if(poetId != null && parentCatId == null)
{
var poet = await _context.GanjoorPoets.AsNoTracking().Where(p => p.Id == poetId).SingleAsync();
parentCatId = poetId;
}
var source =
from cwd in _context.CategoryWordCounts
join catsum in _context.CategoryWordCountSummaries on cwd.CatId equals catsum.CatId