diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index 794443c2..9770092a 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -15930,6 +15930,29 @@
+
+
+ approved section edits daily
+
+
+
+
+
+
+
+ approved section edits grouped by user
+
+
+
+
+
+
+
+
+ summed up stats of approved secton corrections
+
+
+
donation service
@@ -18859,6 +18882,29 @@
+
+
+ approved section edits daily
+
+
+
+
+
+
+
+ approved section edits grouped by user
+
+
+
+
+
+
+
+
+ summed up stats of approved secton corrections
+
+
+
Database Context
diff --git a/RMuseum/Services/IContributionStatsService.cs b/RMuseum/Services/IContributionStatsService.cs
index 054bf688..d59285e0 100644
--- a/RMuseum/Services/IContributionStatsService.cs
+++ b/RMuseum/Services/IContributionStatsService.cs
@@ -33,5 +33,29 @@ namespace RMuseum.Services
///
Task> GetApprrovedEditsSummedUpStatsAsync();
+ ///
+ /// approved section edits daily
+ ///
+ ///
+ ///
+ ///
+ Task> GetApprovedSectionEditsGroupedByDateAsync(PagingParameterModel paging, Guid? userId);
+
+ ///
+ /// approved section edits grouped by user
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task> GetApprovedSectionEditsGroupedByUserAsync(PagingParameterModel paging, DateTime? day, Guid? userId);
+
+ ///
+ /// summed up stats of approved secton corrections
+ ///
+ ///
+ Task> GetApprrovedSedtionEditsSummedUpStatsAsync();
+
+
}
}
diff --git a/RMuseum/Services/Implementation/ContributionStatsService.cs b/RMuseum/Services/Implementation/ContributionStatsService.cs
index a3b2293f..0b918638 100644
--- a/RMuseum/Services/Implementation/ContributionStatsService.cs
+++ b/RMuseum/Services/Implementation/ContributionStatsService.cs
@@ -127,6 +127,120 @@ namespace RMuseum.Services.Implementation
}
}
+ ///
+ /// approved section edits daily
+ ///
+ ///
+ ///
+ ///
+ public async Task> GetApprovedSectionEditsGroupedByDateAsync(PagingParameterModel paging, Guid? userId)
+ {
+ try
+ {
+ return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByDateViewModel[] Tracks)>(
+ await QueryablePaginator.Paginate(
+ _context.GanjoorPoemSectionCorrections
+ .Where(c =>
+ c.AffectedThePoem == true
+ &&
+ (userId == null || c.UserId == userId)
+ )
+ .GroupBy(a => a.Date.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());
+ }
+ }
+
+ ///
+ /// approved section edits grouped by user
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task> GetApprovedSectionEditsGroupedByUserAsync(PagingParameterModel paging, DateTime? day, Guid? userId)
+ {
+ try
+ {
+ return new RServiceResult<(PaginationMetadata PagingMeta, GroupedByUserViewModel[] Tracks)>(
+ await QueryablePaginator.Paginate(
+ _context.GanjoorPoemSectionCorrections
+ .Join
+ (
+ _context.Users,
+ correction => correction.UserId,
+ user => user.Id,
+ (correction, user) => new
+ {
+ correction.Date,
+ UserId = user.Id,
+ UserName = user.NickName,
+ correction.AffectedThePoem,
+ }
+ )
+ .Where(f =>
+ f.AffectedThePoem
+ &&
+ (day == null || f.Date.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());
+ }
+ }
+
+ ///
+ /// summed up stats of approved secton corrections
+ ///
+ ///
+ public async Task> GetApprrovedSedtionEditsSummedUpStatsAsync()
+ {
+ try
+ {
+ return new RServiceResult
+ (
+ new SummedUpViewModel()
+ {
+ Days = await _context.GanjoorPoemSectionCorrections
+ .Where(f => f.AffectedThePoem
+ )
+ .GroupBy(f => f.Date.Date).CountAsync(),
+ TotalCount = await _context.GanjoorPoemSectionCorrections
+
+ .Where(f => f.AffectedThePoem
+ )
+ .CountAsync(),
+ UserIds = await _context.GanjoorPoemSectionCorrections
+ .Where(f => f.AffectedThePoem
+ )
+ .GroupBy(f => f.UserId).CountAsync(),
+ }
+ );
+
+ }
+ catch (Exception e)
+ {
+ return new RServiceResult(null, e.ToString());
+ }
+ }
+
+
///
/// Database Context
///