Fix well service

This commit is contained in:
Степанов Дмитрий 2024-04-12 09:47:17 +03:00
parent 7c88fb23de
commit b734ed929e
2 changed files with 8 additions and 7 deletions

View File

@ -148,17 +148,18 @@ namespace AsbCloudInfrastructure.Services.SAUB
{
if (!caches.TryGetValue(idTelemetry, out TelemetryDataCacheItem? cacheItem))
return null;
var from = cacheItem.FirstByDate?.DateTime;
if (!cacheItem.LastData.Any())
return null;
var from = cacheItem.FirstByDate.DateTime;
var to = cacheItem.LastData[^1].DateTime;
from = from ?? cacheItem.LastData[0].DateTime;
return new DatesRangeDto {
From = from.Value.ToUtcDateTimeOffset(cacheItem.TimezoneHours),
To = to.ToUtcDateTimeOffset(cacheItem.TimezoneHours) };
return new DatesRangeDto
{
From = new DateTimeOffset(from, TimeSpan.FromHours(cacheItem.TimezoneHours)),
To = new DateTimeOffset(to, TimeSpan.FromHours(cacheItem.TimezoneHours))
};
}
public DatesRangeDto? GetOrDefaultCachedDateRange(int idTelemetry)

View File

@ -71,7 +71,7 @@ namespace AsbCloudInfrastructure.Services
return DateTimeOffset.MinValue;
var datesRange = telemetryService.GetDatesRange(well.IdTelemetry.Value);
return datesRange.To.DateTime;
return datesRange.To;
}
/// <inheritdoc/>