Ensure correct sorting and thus also correct liter per 100km calculation
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -52,10 +52,9 @@ public static class GetConsumptions
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Dictionary<CarId, List<Consumption>> consumptionsByCar = await dbContext.Consumptions
|
||||
.OrderByDescending(x => x.DateTime)
|
||||
.Include(x => x.Car)
|
||||
.GroupBy(x => x.CarId)
|
||||
.ToDictionaryAsync(x => x.Key, x => x.ToList(), cancellationToken);
|
||||
.ToDictionaryAsync(x => x.Key, x => x.OrderByDescending(x => x.DateTime).ToList(), cancellationToken);
|
||||
|
||||
List<ResponseDto> responses = [];
|
||||
|
||||
@@ -85,7 +84,10 @@ public static class GetConsumptions
|
||||
}
|
||||
}
|
||||
|
||||
ApiResponse apiResponse = new() { Consumptions = responses };
|
||||
ApiResponse apiResponse = new()
|
||||
{
|
||||
Consumptions = responses
|
||||
};
|
||||
return TypedResults.Ok(apiResponse);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user