Skip to content

Commit

Permalink
CDMS-179 optimises Movements ByItemCount analytics for bigger datasets (
Browse files Browse the repository at this point in the history
  • Loading branch information
craigedmunds authored and Ian Shimmings committed Dec 10, 2024
1 parent f9fe8b2 commit f418582
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Btms.Analytics/MovementsAggregationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,9 @@ public Task<MultiSeriesDataset[]> ByUniqueDocumentReferenceCount(DateTime from,
.Distinct()
.Count()
})
.GroupBy(g => g.Key.Linked);

var mongoResult = mongoQuery
.Execute(logger)
.SelectMany(g => g.Select(l => new
{
Linked = g.Key,
l.Key.DocumentReferenceCount,
MovementCount = l.Count()
}))
.ToList();
.Select(g => new { g.Key.Linked, g.Key.DocumentReferenceCount, MovementCount = g.Count() });

var mongoResult = mongoQuery.Execute(logger).ToList();

var dictionary = mongoResult
.ToDictionary(
Expand Down

0 comments on commit f418582

Please sign in to comment.