forked from ddrilling/AsbCloudServer
#15287262 Сделал OperationStatRequest.DurationMinutes* double
This commit is contained in:
parent
2b400012c6
commit
6eb118e9f6
@ -5,9 +5,8 @@ namespace AsbCloudApp.Requests
|
||||
/// <summary>
|
||||
/// Параметры фильтра операции
|
||||
/// </summary>
|
||||
public class OperationStatRequest : RequestBase
|
||||
public class OperationStatRequest
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Дата начала операции в UTC
|
||||
/// </summary>
|
||||
@ -18,17 +17,14 @@ namespace AsbCloudApp.Requests
|
||||
/// </summary>
|
||||
public DateTime? DateEndUTC { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Минимальная продолжительность операции, мин
|
||||
/// </summary>
|
||||
public int? DurationMinutesMin { get; set; }
|
||||
public double? DurationMinutesMin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Максимальная продолжительность операции, мин
|
||||
/// </summary>
|
||||
public int? DurationMinutesMax { get; set; }
|
||||
|
||||
|
||||
public double? DurationMinutesMax { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,12 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
namespace AsbCloudInfrastructure.Services;
|
||||
|
||||
public class SlipsStatService : ISlipsStatService
|
||||
{
|
||||
private readonly IAsbCloudDbContext db;
|
||||
|
||||
public SlipsStatService(IAsbCloudDbContext db)
|
||||
{
|
||||
this.db = db;
|
||||
@ -84,13 +85,14 @@ namespace AsbCloudInfrastructure.Services
|
||||
|
||||
if (request.DurationMinutesMin.HasValue)
|
||||
{
|
||||
var durationMinutesMin = new TimeSpan(0, request.DurationMinutesMin.Value, 0);
|
||||
var durationMinutesMin = TimeSpan.FromMinutes(request.DurationMinutesMin.Value);
|
||||
detectedOperationsQuery = detectedOperationsQuery
|
||||
.Where(o => o.DateEnd - o.DateStart >= durationMinutesMin);
|
||||
}
|
||||
|
||||
if (request.DurationMinutesMax.HasValue)
|
||||
{
|
||||
var durationMinutesMax = new TimeSpan(0, request.DurationMinutesMax.Value, 0);
|
||||
var durationMinutesMax = TimeSpan.FromMinutes(request.DurationMinutesMax.Value);
|
||||
detectedOperationsQuery = detectedOperationsQuery
|
||||
.Where(o => o.DateEnd - o.DateStart <= durationMinutesMax);
|
||||
}
|
||||
@ -159,4 +161,3 @@ namespace AsbCloudInfrastructure.Services
|
||||
return stats;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user