#478 poet spec lines
This commit is contained in:
parent
f667668aa3
commit
a200978a0c
@ -16150,6 +16150,20 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IContributionStatsService.GetApprovedPoetSpecLinesGroupedByUserAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
approved poet spec lines grouped by user
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IContributionStatsService.GetApprovedPoetSpecLinesSummedUpStatsAsync">
|
||||
<summary>
|
||||
summed up stats of approved poet spec lines
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.IDonationService">
|
||||
<summary>
|
||||
donation service
|
||||
@ -19263,6 +19277,20 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ContributionStatsService.GetApprovedPoetSpecLinesGroupedByUserAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
approved poet spec lines grouped by user
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ContributionStatsService.GetApprovedPoetSpecLinesSummedUpStatsAsync">
|
||||
<summary>
|
||||
summed up stats of approved poet spec lines
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:RMuseum.Services.Implementation.ContributionStatsService._context">
|
||||
<summary>
|
||||
Database Context
|
||||
|
||||
@ -217,5 +217,19 @@ namespace RMuseum.Services
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<SummedUpViewModel>> GetApprovedPinterestLinksSummedUpStatsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// approved poet spec lines grouped by user
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>> GetApprovedPoetSpecLinesGroupedByUserAsync(PagingParameterModel paging, Guid? userId);
|
||||
|
||||
/// <summary>
|
||||
/// summed up stats of approved poet spec lines
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<SummedUpViewModel>> GetApprovedPoetSpecLinesSummedUpStatsAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1033,6 +1033,83 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// approved poet spec lines grouped by user
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>> GetApprovedPoetSpecLinesGroupedByUserAsync(PagingParameterModel paging, Guid? userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>(
|
||||
await QueryablePaginator<GroupedByUserViewModel>.Paginate(
|
||||
_context.GanjoorPoetSuggestedSpecLines
|
||||
.Join
|
||||
(
|
||||
_context.Users,
|
||||
correction => correction.SuggestedById,
|
||||
user => user.Id,
|
||||
(correction, user) => new
|
||||
{
|
||||
UserId = user.Id,
|
||||
UserName = user.NickName,
|
||||
correction.Published,
|
||||
}
|
||||
)
|
||||
.Where(f =>
|
||||
f.Published
|
||||
&&
|
||||
(userId == null || f.UserId == userId))
|
||||
.GroupBy(a => new { a.UserId, a.UserName }).Select(a => new GroupedByUserViewModel()
|
||||
{
|
||||
UserId = a.Key.UserId,
|
||||
UserName = a.Key.UserName,
|
||||
Number = a.Count(),
|
||||
}).OrderByDescending(s => s.Number)
|
||||
, paging));
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>((null, null), e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// summed up stats of approved poet spec lines
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<SummedUpViewModel>> GetApprovedPoetSpecLinesSummedUpStatsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<SummedUpViewModel>
|
||||
(
|
||||
new SummedUpViewModel()
|
||||
{
|
||||
Days = 0,
|
||||
TotalCount = await _context.GanjoorPoetSuggestedSpecLines
|
||||
|
||||
.Where(f => f.Published
|
||||
)
|
||||
.CountAsync(),
|
||||
UserIds = await _context.GanjoorPoetSuggestedSpecLines
|
||||
.Where(f => f.Published
|
||||
)
|
||||
.GroupBy(f => f.SuggestedById).CountAsync(),
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new RServiceResult<SummedUpViewModel>(null, e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user