CS2-88: Fixed analyze start date calculation

This commit is contained in:
KharchenkoVV 2021-09-28 14:37:44 +05:00
parent 130feacdd5
commit 0132407dd8

View File

@ -323,13 +323,15 @@ namespace AsbCloudInfrastructure.Services
.DefaultIfEmpty()
.Last();
var lastAnalysisUnixDate = lastAnalysisInDb?.UnixDate ?? 0;
var lastAnalysisUnixDate = lastAnalysisInDb?.UnixDate ?? default;
var analyzeStartDate = DateTimeOffset.FromUnixTimeSeconds(lastAnalysisUnixDate);
var analyzeStartDate = lastAnalysisUnixDate == default
? DateTimeOffset.MinValue
: DateTimeOffset.FromUnixTimeSeconds(lastAnalysisUnixDate);
var firstDataSaub = (from ds in db.TelemetryDataSaub
where ds.IdTelemetry == idTelemetry &&
ds.Date > analyzeStartDate
ds.Date >= analyzeStartDate
select ds).FirstOrDefault();
var firstSaubUtcTime = firstDataSaub.Date.ToUniversalTime();