diff --git a/RMuseum/Services/IContributionStatsService.cs b/RMuseum/Services/IContributionStatsService.cs
index 741a7a3d..ce412f05 100644
--- a/RMuseum/Services/IContributionStatsService.cs
+++ b/RMuseum/Services/IContributionStatsService.cs
@@ -231,5 +231,20 @@ namespace RMuseum.Services
///
///
Task> GetApprovedPoetSpecLinesSummedUpStatsAsync();
+
+ ///
+ /// approved poet spec pictures grouped by user
+ ///
+ ///
+ ///
+ ///
+ Task> GetApprovedGanjoorPoetSuggestedPicturesGroupedByUserAsync(PagingParameterModel paging, Guid? userId);
+
+ ///
+ /// summed up stats of approved poet pictures
+ ///
+ ///
+ Task> GetApprovedGanjoorPoetSuggestedPicturesSummedUpStatsAsync();
+
}
}
diff --git a/RMuseum/Services/Implementation/ContributionStatsService.cs b/RMuseum/Services/Implementation/ContributionStatsService.cs
index 793672c8..dea9937b 100644
--- a/RMuseum/Services/Implementation/ContributionStatsService.cs
+++ b/RMuseum/Services/Implementation/ContributionStatsService.cs
@@ -1110,6 +1110,81 @@ namespace RMuseum.Services.Implementation
}
+ ///
+ /// approved poet spec pictures grouped by user
+ ///
+ ///
+ ///
+ ///
+ public async Task> GetApprovedGanjoorPoetSuggestedPicturesGroupedByUserAsync(PagingParameterModel paging, Guid? userId)
+ {
+ try
+ {
+ return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>(
+ await QueryablePaginator.Paginate(
+ _context.GanjoorPoetSuggestedPictures
+ .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());
+ }
+ }
+
+ ///
+ /// summed up stats of approved poet pictures
+ ///
+ ///
+ public async Task> GetApprovedGanjoorPoetSuggestedPicturesSummedUpStatsAsync()
+ {
+ try
+ {
+ return new RServiceResult
+ (
+ new SummedUpViewModel()
+ {
+ Days = 0,
+ TotalCount = await _context.GanjoorPoetSuggestedPictures
+
+ .Where(f => f.Published
+ )
+ .CountAsync(),
+ UserIds = await _context.GanjoorPoetSuggestedPictures
+ .Where(f => f.Published
+ )
+ .GroupBy(f => f.SuggestedById).CountAsync(),
+ }
+ );
+
+ }
+ catch (Exception e)
+ {
+ return new RServiceResult(null, e.ToString());
+ }
+ }
///