Правка бага: если с фронта не приходит период времени, то данные по наработке систем нужно выводить за всё время

This commit is contained in:
Olga Nemt 2024-09-30 09:56:34 +05:00
parent 2b8057bbba
commit a137136e21
3 changed files with 7 additions and 6 deletions

View File

@ -9,7 +9,7 @@ namespace AsbCloudApp.Requests;
/// </summary>
public class SubsystemBaseRequest: RequestBase, IValidatableObject
{
private static readonly DateTimeOffset validationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero);
public static readonly DateTimeOffset ValidationMinDate = new DateTimeOffset(2020,01,01,0,0,0, TimeSpan.Zero);
/// <summary>
/// Больше или равно дате
@ -34,9 +34,9 @@ public class SubsystemBaseRequest: RequestBase, IValidatableObject
/// <inheritdoc/>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (GeDate.HasValue && GeDate < validationMinDate)
if (GeDate.HasValue && GeDate < ValidationMinDate)
yield return new ValidationResult(
$"Должно быть больше {validationMinDate:O})",
$"Должно быть больше {ValidationMinDate:O})",
new[] { nameof(GeDate) });
if (LeDate.HasValue && GeDate.HasValue)

View File

@ -13,5 +13,6 @@ public class SubsystemPlanFactRequest: SubsystemBaseRequest
/// <summary>
/// идентификаторы скважин
/// </summary>
public IEnumerable<int> IdsWell { get; set; } = Enumerable.Empty<int>();
[Required]
public IEnumerable<int> IdsWell { get; set; } = null!;
}

View File

@ -142,8 +142,8 @@ public class SubsystemService : ISubsystemService
.ToDictionary(t => t.Id, t => t.IdWell);
var dtNow = DateTimeOffset.UtcNow;
var geDate = request.GeDate ?? new DateTimeOffset(dtNow.Date);
var leDate = request.LeDate ?? geDate.AddDays(1).AddMinutes(-1);
var geDate = request.GeDate ?? SubsystemPlanFactRequest.ValidationMinDate;
var leDate = request.LeDate ?? DateTimeOffset.UtcNow;
var telemetryDataSaub = await telemetryDataSaubService.Get(telemetriesDict.Keys, false, geDate, leDate, 100_000, token);
var groupedTelemetryDataSaub = telemetryDataSaub