comparison of usage stats of a selected word among all poets #471
This commit is contained in:
parent
47556018c2
commit
7d7bcc130f
@ -17487,6 +17487,15 @@
|
||||
<param name="poetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetCategoryWordCountByTermAsync(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
get CategoryWordCount for a specific term in a category
|
||||
</summary>
|
||||
<param name="term"></param>
|
||||
<param name="catId"></param>
|
||||
<param name="poetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.TajikImportFromSqlite(System.Int32,System.String)">
|
||||
<summary>
|
||||
tajik import from sqlite
|
||||
@ -19278,6 +19287,15 @@
|
||||
<param name="poetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetCategoryWordCountByTermAsync(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32})">
|
||||
<summary>
|
||||
get CategoryWordCount for a specific term in a category
|
||||
</summary>
|
||||
<param name="term"></param>
|
||||
<param name="catId"></param>
|
||||
<param name="poetId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.BuildCategoryWordCountsAsync(System.Boolean,System.Int32)">
|
||||
<summary>
|
||||
build word counts
|
||||
|
||||
@ -1511,6 +1511,15 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, PoetOrCatWordStat[] Items)>> GetCategoryWordCountsBySubCatsAsync(string term, PagingParameterModel paging, int? parentCatId, int? poetId);
|
||||
|
||||
/// <summary>
|
||||
/// get CategoryWordCount for a specific term in a category
|
||||
/// </summary>
|
||||
/// <param name="term"></param>
|
||||
/// <param name="catId"></param>
|
||||
/// <param name="poetId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<CategoryWordCount>> GetCategoryWordCountByTermAsync(string term, int? catId, int? poetId);
|
||||
|
||||
/// <summary>
|
||||
/// tajik import from sqlite
|
||||
/// </summary>
|
||||
|
||||
@ -112,6 +112,35 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get CategoryWordCount for a specific term in a category
|
||||
/// </summary>
|
||||
/// <param name="term"></param>
|
||||
/// <param name="catId"></param>
|
||||
/// <param name="poetId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<CategoryWordCount>> GetCategoryWordCountByTermAsync(string term, int? catId, int? poetId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (poetId != null && catId == null)
|
||||
{
|
||||
var cat = await _context.GanjoorCategories.AsNoTracking().Where(p => p.PoetId == poetId && p.ParentId == null).SingleAsync();
|
||||
catId = cat.Id;
|
||||
}
|
||||
if (catId == null)
|
||||
{
|
||||
catId = 0;
|
||||
}
|
||||
|
||||
return new RServiceResult<CategoryWordCount>(await _context.CategoryWordCounts.AsNoTracking().Where(s => s.CatId == catId && s.Word == term).OrderBy(s => s.RowNmbrInCat).FirstOrDefaultAsync());
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<CategoryWordCount>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// build word counts
|
||||
|
||||
@ -58,7 +58,7 @@ namespace RMuseum
|
||||
builder => builder.SetIsOriginAllowed(_ => true)
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.WithExposedHeaders("paging-headers", "audio-upload-enabled")
|
||||
.WithExposedHeaders("paging-headers", "audio-upload-enabled", "items-count")
|
||||
.AllowCredentials()
|
||||
);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user