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 Dec 10, 2024
1 parent 70ab5ac commit 315714c
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Btms.Analytics/MovementsAggregationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,10 @@ public Task<MultiSeriesDataset[]> ByUniqueDocumentReferenceCount(DateTime from,
.Distinct()
.Count()
})
.GroupBy(g => g.Key.Linked);

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

var dictionary = mongoResult
Expand Down

0 comments on commit 315714c

Please sign in to comment.