AutoGeneratedDailyReportService.GetListAsync(..) fix Count calculations.

This commit is contained in:
ngfrolov 2023-07-25 17:31:54 +05:00
parent b7f5739d8c
commit 39dcf49812
Signed by: ng.frolov
GPG Key ID: E99907A0357B29A7

View File

@ -69,12 +69,14 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
var datesRange = telemetryDataCache.GetOrDefaultDataDateRange(well.IdTelemetry.Value);
if (datesRange is null)
if (datesRange is null)
return result;
result.Count = (int)(Math.Ceiling((datesRange.To - DateTime.UnixEpoch).TotalDays) - Math.Floor((datesRange.From - DateTime.UnixEpoch).TotalDays));
if (request.StartDate.HasValue)
{
var startDate = new DateTime(request.StartDate.Value.Year, request.StartDate.Value.Month,
var startDate = new DateTime(request.StartDate.Value.Year, request.StartDate.Value.Month,
request.StartDate.Value.Day);
if(startDate.Date >= datesRange.From.Date)
@ -103,7 +105,6 @@ public class AutoGeneratedDailyReportService : IAutoGeneratedDailyReportService
}
result.Items = reports;
result.Count = reports.Count;
return result;
}