parent
cb18240ed3
commit
988e92393c
11
RMuseum/Models/Ganjoor/ViewModels/PoetOrCatWordStat.cs
Normal file
11
RMuseum/Models/Ganjoor/ViewModels/PoetOrCatWordStat.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace RMuseum.Models.Ganjoor.ViewModels
|
||||
{
|
||||
public class PoetOrCatWordStat
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Count { get; set; }
|
||||
public int RowNmbrInCat { get; set; }
|
||||
public int TotalWordCount { get; set; }
|
||||
}
|
||||
}
|
||||
@ -19233,6 +19233,14 @@
|
||||
<param name="catId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetCategoryWordCountsByPoetsAsync(System.String,RSecurityBackend.Models.Generic.PagingParameterModel)">
|
||||
<summary>
|
||||
comparison of word counts for poets
|
||||
</summary>
|
||||
<param name="term"></param>
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.BuildCategoryWordCountsAsync(System.Boolean,System.Int32)">
|
||||
<summary>
|
||||
build word counts
|
||||
|
||||
@ -9,6 +9,7 @@ using RSecurityBackend.Services.Implementation;
|
||||
using System.Threading.Tasks;
|
||||
using RSecurityBackend.Models.Generic.Db;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
|
||||
namespace RMuseum.Services.Implementation
|
||||
{
|
||||
@ -66,6 +67,43 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// comparison of word counts for poets
|
||||
/// </summary>
|
||||
/// <param name="term"></param>
|
||||
/// <param name="paging"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsByPoetsAsync(string term, PagingParameterModel paging)
|
||||
{
|
||||
try
|
||||
{
|
||||
var source =
|
||||
from cwd in _context.CategoryWordCounts
|
||||
join catsum in _context.CategoryWordCountSummaries on cwd.Id equals catsum.Id
|
||||
join cat in _context.GanjoorCategories on cwd.CatId equals cat.Id
|
||||
where cat.ParentId == 0 && cwd.Word == term
|
||||
orderby cwd.Count
|
||||
select
|
||||
new PoetOrCatWordStat()
|
||||
{
|
||||
Id = cat.PoetId,
|
||||
Name = cat.Title,
|
||||
Count = cwd.Count,
|
||||
RowNmbrInCat = cwd.RowNmbrInCat,
|
||||
TotalWordCount = catsum.TotalWordCount,
|
||||
};
|
||||
|
||||
(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items) paginatedResult =
|
||||
await QueryablePaginator<PoetOrCatWordStat>.Paginate(source, paging);
|
||||
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>(paginatedResult);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>((null, null), exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// build word counts
|
||||
|
||||
Loading…
Reference in New Issue
Block a user