#478 pinterest links
This commit is contained in:
parent
43f8c07e69
commit
b7a49214c5
@ -19214,6 +19214,29 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ContributionStatsService.GetApprovedPinterestLinksGroupedByDateAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
approved pinterest links daily
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ContributionStatsService.GetApprovedPinterestLinksGroupedByUserAsync(RSecurityBackend.Models.Generic.PagingParameterModel,System.Nullable{System.DateTime},System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
approved pinterest links grouped by user
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<param name="day"></param>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.ContributionStatsService.GetApprovedPinterestLinksSummedUpStatsAsync">
|
||||
<summary>
|
||||
summed up stats of approved pinterest links
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="F:RMuseum.Services.Implementation.ContributionStatsService._context">
|
||||
<summary>
|
||||
Database Context
|
||||
|
||||
@ -195,5 +195,27 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<SummedUpViewModel>> GetApprovedMuseumLinksSummedUpStatsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// approved pinterest links daily
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>> GetApprovedPinterestLinksGroupedByDateAsync(PagingParameterModel paging, Guid? userId);
|
||||
|
||||
/// <summary>
|
||||
/// approved pinterest links grouped by user
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="day"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>> GetApprovedPinterestLinksGroupedByUserAsync(PagingParameterModel paging, DateTime? day, Guid? userId);
|
||||
|
||||
/// <summary>
|
||||
/// summed up stats of approved pinterest links
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<SummedUpViewModel>> GetApprovedPinterestLinksSummedUpStatsAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@ -920,6 +920,120 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// approved pinterest links daily
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>> GetApprovedPinterestLinksGroupedByDateAsync(PagingParameterModel paging, Guid? userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>(
|
||||
await QueryablePaginator<GroupedByDateViewModel>.Paginate(
|
||||
_context.PinterestLinks
|
||||
.Where(c =>
|
||||
c.ReviewResult == Models.GanjoorIntegration.ReviewResult.Approved
|
||||
&&
|
||||
(userId == null || c.SuggestedById == userId)
|
||||
)
|
||||
.GroupBy(a => a.SuggestionDate.Date)
|
||||
.Select(a => new GroupedByDateViewModel()
|
||||
{
|
||||
Date = a.Key.Date.ToString(),
|
||||
Number = a.Count(),
|
||||
}).OrderByDescending(s => s.Date)
|
||||
, paging));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>((null, null), e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// approved pinterest links grouped by user
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <param name="day"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>> GetApprovedPinterestLinksGroupedByUserAsync(PagingParameterModel paging, DateTime? day, Guid? userId)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>(
|
||||
await QueryablePaginator<GroupedByUserViewModel>.Paginate(
|
||||
_context.PinterestLinks
|
||||
.Join
|
||||
(
|
||||
_context.Users,
|
||||
correction => correction.SuggestedById,
|
||||
user => user.Id,
|
||||
(correction, user) => new
|
||||
{
|
||||
correction.SuggestionDate,
|
||||
UserId = user.Id,
|
||||
UserName = user.NickName,
|
||||
correction.ReviewResult,
|
||||
}
|
||||
)
|
||||
.Where(f =>
|
||||
f.ReviewResult == Models.GanjoorIntegration.ReviewResult.Approved
|
||||
&&
|
||||
(day == null || f.SuggestionDate.Date == day) && (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 pinterest links
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<SummedUpViewModel>> GetApprovedPinterestLinksSummedUpStatsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RServiceResult<SummedUpViewModel>
|
||||
(
|
||||
new SummedUpViewModel()
|
||||
{
|
||||
Days = await _context.PinterestLinks
|
||||
.Where(f => f.ReviewResult == Models.GanjoorIntegration.ReviewResult.Approved
|
||||
)
|
||||
.GroupBy(f => f.SuggestionDate.Date).CountAsync(),
|
||||
TotalCount = await _context.PinterestLinks
|
||||
|
||||
.Where(f => f.ReviewResult == Models.GanjoorIntegration.ReviewResult.Approved
|
||||
)
|
||||
.CountAsync(),
|
||||
UserIds = await _context.PinterestLinks
|
||||
.Where(f => f.ReviewResult == Models.GanjoorIntegration.ReviewResult.Approved
|
||||
)
|
||||
.GroupBy(f => f.SuggestedById).CountAsync(),
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new RServiceResult<SummedUpViewModel>(null, e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Database Context
|
||||
|
||||
Loading…
Reference in New Issue
Block a user