Merge pull request 'Правка бага: если с фронта не приходит период времени, то данные по наработке систем нужно выводить за всё время' (#330) from feature/#37115045-subsystems-operation-time into dev

Reviewed-on: https://test.digitaldrilling.ru:8443/DDrilling/AsbCloudServer/pulls/330
This commit is contained in:
Никита Фролов 2024-09-30 17:06:33 +05:00
commit 50f6c764ba
3 changed files with 7 additions and 6 deletions

View File

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

View File

@ -13,5 +13,6 @@ public class SubsystemPlanFactRequest: SubsystemBaseRequest
/// <summary> /// <summary>
/// идентификаторы скважин /// идентификаторы скважин
/// </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); .ToDictionary(t => t.Id, t => t.IdWell);
var dtNow = DateTimeOffset.UtcNow; var dtNow = DateTimeOffset.UtcNow;
var geDate = request.GeDate ?? new DateTimeOffset(dtNow.Date); var geDate = request.GeDate ?? SubsystemPlanFactRequest.ValidationMinDate;
var leDate = request.LeDate ?? geDate.AddDays(1).AddMinutes(-1); var leDate = request.LeDate ?? DateTimeOffset.UtcNow;
var telemetryDataSaub = await telemetryDataSaubService.Get(telemetriesDict.Keys, false, geDate, leDate, 100_000, token); var telemetryDataSaub = await telemetryDataSaubService.Get(telemetriesDict.Keys, false, geDate, leDate, 100_000, token);
var groupedTelemetryDataSaub = telemetryDataSaub var groupedTelemetryDataSaub = telemetryDataSaub