feat: implement commission calculation strategy with ORM and SP options
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m43s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 1m43s
This commit is contained in:
+7
-3
@@ -56,16 +56,20 @@ public class GetNetworkStatisticsQueryHandler : IRequestHandler<GetNetworkStatis
|
||||
|
||||
// Monthly growth (last 6 months) - using Created date
|
||||
var sixMonthsAgo = DateTime.Now.AddMonths(-6);
|
||||
var monthlyGrowth = await _context.Users
|
||||
var monthlyGrowthRaw = await _context.Users
|
||||
.Where(x => x.NetworkParentId != null && x.Created >= sixMonthsAgo)
|
||||
.GroupBy(x => new { x.Created.Year, x.Created.Month })
|
||||
.Select(x => new { x.Created.Year, x.Created.Month })
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
var monthlyGrowth = monthlyGrowthRaw
|
||||
.GroupBy(x => new { x.Year, x.Month })
|
||||
.Select(g => new MonthlyGrowthModel
|
||||
{
|
||||
Month = $"{g.Key.Year}-{g.Key.Month:D2}",
|
||||
NewMembers = g.Count()
|
||||
})
|
||||
.OrderBy(x => x.Month)
|
||||
.ToListAsync(cancellationToken);
|
||||
.ToList();
|
||||
|
||||
// Top users by total children count
|
||||
var topUsers = await _context.Users
|
||||
|
||||
Reference in New Issue
Block a user