Skip to content

Commit

Permalink
CDMS-179 removes movements by arrival date as clearance requests don'…
Browse files Browse the repository at this point in the history
…t have arrival dates in prod :|
  • Loading branch information
craigedmunds committed Dec 9, 2024
1 parent 84e584c commit f48722d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 74 deletions.
49 changes: 0 additions & 49 deletions Btms.Analytics.Tests/MovementsByArrivalDateTests.cs

This file was deleted.

1 change: 0 additions & 1 deletion Btms.Analytics/IMovementsAggregationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ namespace Btms.Analytics;
public interface IMovementsAggregationService
{
public Task<MultiSeriesDatetimeDataset[]> ByCreated(DateTime from, DateTime to, AggregationPeriod aggregateBy = AggregationPeriod.Day);
public Task<MultiSeriesDatetimeDataset[]> ByArrival(DateTime from, DateTime to, AggregationPeriod aggregateBy = AggregationPeriod.Day);
public Task<SingeSeriesDataset> ByStatus(DateTime from, DateTime to);
public Task<MultiSeriesDataset[]> ByItemCount(DateTime from, DateTime to);
public Task<MultiSeriesDataset[]> ByUniqueDocumentReferenceCount(DateTime from, DateTime to);
Expand Down
19 changes: 0 additions & 19 deletions Btms.Analytics/MovementsAggregationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@ public Task<MultiSeriesDatetimeDataset[]> ByCreated(DateTime from, DateTime to,
return Aggregate(dateRange, CreateDatasetName, matchFilter, "$createdSource", aggregateBy);
}

/// <summary>
/// Aggregates movements by arrival date and returns counts by date period. Could be refactored to use a generic/interface in time
/// </summary>
/// <param name="from">Time period to search from (inclusive)</param>
/// <param name="to">Time period to search to (exclusive)</param>
/// <param name="aggregateBy">Aggregate by day/hour</param>
/// <returns></returns>
public Task<MultiSeriesDatetimeDataset[]> ByArrival(DateTime from, DateTime to, AggregationPeriod aggregateBy = AggregationPeriod.Day)
{
var dateRange = AnalyticsHelpers.CreateDateRange(from, to, aggregateBy);

Expression<Func<Movement, bool>> matchFilter = n =>
n.CreatedSource >= from && n.CreatedSource < to;

string CreateDatasetName(BsonDocument b) => AnalyticsHelpers.GetLinkedName(b["_id"]["linked"].ToBoolean());

return Aggregate(dateRange, CreateDatasetName, matchFilter, "$arrivesAt", aggregateBy);
}

public Task<SingeSeriesDataset> ByStatus(DateTime from, DateTime to)
{
var data = context
Expand Down
5 changes: 0 additions & 5 deletions Btms.Backend/Endpoints/AnalyticsEndpoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ private static async Task<IResult> GetDashboard(
var movementsLinkingByCreated = await movementsService
.ByCreated(DateTime.Today.MonthAgo(), DateTime.Today);

var movementsLinkingByArrival = await movementsService
.ByArrival(DateTime.Today.MonthAgo(), DateTime.Today.MonthLater());

var lastMonthMovementsByStatus = await movementsService
.ByStatus(DateTime.Today.MonthAgo(), DateTime.Now);

Expand All @@ -76,8 +73,6 @@ private static async Task<IResult> GetDashboard(
last24HoursMovementsLinkingByCreated,
last24HoursImportNotificationsLinkingByCreated,
movementsLinkingByCreated,
movementsLinkingByArrival,
lastMonthImportNotificationsByTypeAndStatus,
lastMonthMovementsByStatus,
lastMonthMovementsByItemCount,
lastMonthImportNotificationsByCommodityCount,
Expand Down

0 comments on commit f48722d

Please sign in to comment.