forked from ddrilling/AsbCloudServer
nit deleting an outdated tasks
This commit is contained in:
parent
c06712f2f9
commit
464678a3db
@ -22,10 +22,6 @@ namespace AsbCloudApp.Data
|
||||
[Range(1, int.MaxValue, ErrorMessage = "Id категории не может быть ниже 1")]
|
||||
public int CategoryId { get; set; }
|
||||
|
||||
//TODO: в модели дто сообщения отсутствует поле Id скважины
|
||||
// скорее всего опечатка т.к. используется глубина в правиле валидатора
|
||||
//в других валидаторах парамтр глубины идет рэнжированный от...до
|
||||
|
||||
/// <summary>
|
||||
/// глубина забоя, при котором событие возникло
|
||||
/// </summary>
|
||||
|
@ -10,7 +10,6 @@ namespace AsbCloudApp.Services
|
||||
/// </summary>
|
||||
public interface IScheduleRepository : IRepositoryWellRelated<ScheduleDto>
|
||||
{
|
||||
// TODO: this should be nullable.
|
||||
/// <summary>
|
||||
/// получить бурильщика по idWell и времени
|
||||
/// </summary>
|
||||
@ -18,6 +17,6 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="workTime"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<DrillerDto?> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
|
||||
Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace AsbCloudApp.Services
|
||||
/// <param name="approxPointsCount">кол-во элементов до которых эти данные прореживаются</param>
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
Task<IEnumerable<TDto>?> GetOrDefaultAsync(int idWell,
|
||||
Task<IEnumerable<TDto>> GetAsync(int idWell,
|
||||
DateTime dateBegin = default, double intervalSec = 600d,
|
||||
int approxPointsCount = 1024, CancellationToken token = default);
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
this.wellService = wellService;
|
||||
}
|
||||
|
||||
public async Task<DrillerDto?> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
||||
public async Task<DrillerDto?> GetOrDefaultDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
||||
{
|
||||
var hoursOffset = wellService.GetTimezone(idWell).Hours;
|
||||
var date = workTime.ToUtcDateTimeOffset(hoursOffset);
|
||||
|
@ -86,16 +86,14 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: It shouldn`t be nullable. Throw exceptions instead and return empty.
|
||||
/// <inheritdoc/>
|
||||
public virtual async Task<IEnumerable<TDto>?> GetOrDefaultAsync(int idWell,
|
||||
public virtual async Task<IEnumerable<TDto>> GetAsync(int idWell,
|
||||
DateTime dateBegin = default, double intervalSec = 600d,
|
||||
int approxPointsCount = 1024, CancellationToken token = default)
|
||||
{
|
||||
var telemetry = telemetryService.GetOrDefaultTelemetryByIdWell(idWell);
|
||||
if (telemetry is null)
|
||||
return null;
|
||||
return Enumerable.Empty<TDto>();
|
||||
|
||||
var timezone = telemetryService.GetTimezone(telemetry.Id);
|
||||
|
||||
@ -134,7 +132,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (fullDataCount == 0)
|
||||
return default;
|
||||
return Enumerable.Empty<TDto>();
|
||||
|
||||
if (fullDataCount > 1.75 * approxPointsCount)
|
||||
{
|
||||
|
@ -121,8 +121,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
_ => 32_768
|
||||
};
|
||||
|
||||
var data = await GetOrDefaultAsync(idWell, beginDate, intervalSec, approxPointsCount, token )
|
||||
?? Enumerable.Empty<TelemetryDataSaubDto>();
|
||||
var data = await GetAsync(idWell, beginDate, intervalSec, approxPointsCount, token );
|
||||
|
||||
var fileName = $"DataSaub idWell{idWell}";
|
||||
if (telemetry.Info is not null)
|
||||
|
@ -35,7 +35,7 @@ namespace AsbCloudWebApi.Tests.Middlware
|
||||
|
||||
public class TelemetryDataSaubService : ITelemetryDataSaubService
|
||||
{
|
||||
public async Task<IEnumerable<TelemetryDataSaubDto>?> GetOrDefaultAsync(int idWell, DateTime dateBegin = default, double intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
public async Task<IEnumerable<TelemetryDataSaubDto>?> GetAsync(int idWell, DateTime dateBegin = default, double intervalSec = 600, int approxPointsCount = 1024, CancellationToken token = default)
|
||||
{
|
||||
await Task.Delay(1000, token);
|
||||
return Enumerable.Empty<TelemetryDataSaubDto>();
|
||||
|
@ -77,22 +77,17 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("cluster/{idCluster}/stat")] // TODO: Это статистика кластера, перенести в ClusterOperationStatController
|
||||
[Route("cluster/{idCluster}/stat")]
|
||||
[Permission]
|
||||
[ProducesResponseType(typeof(StatClusterDto), (int)System.Net.HttpStatusCode.OK)]
|
||||
public async Task<IActionResult> GetStatClusterAsync(int idCluster,
|
||||
CancellationToken token = default)
|
||||
{
|
||||
int? idCompanyOrNull = User.GetCompanyId();
|
||||
if (idCompanyOrNull is null)
|
||||
int? idCompany = User.GetCompanyId();
|
||||
if (idCompany is null)
|
||||
return Forbid();
|
||||
|
||||
int idCompany = idCompanyOrNull ?? 0;
|
||||
// TODO: Fix next commented lines
|
||||
//if (!await CanUserAccessToWellAsync(idCluster, token).ConfigureAwait(false))
|
||||
// return Forbid();
|
||||
|
||||
var result = await operationsStatService.GetStatClusterAsync(idCluster, idCompany, token)
|
||||
var result = await operationsStatService.GetStatClusterAsync(idCluster, idCompany.Value, token)
|
||||
.ConfigureAwait(false);
|
||||
return Ok(result);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace AsbCloudWebApi.Controllers.SAUB
|
||||
if (!isCompanyOwnsWell)
|
||||
return Forbid();
|
||||
|
||||
var content = await telemetryDataService.GetOrDefaultAsync(idWell, begin,
|
||||
var content = await telemetryDataService.GetAsync(idWell, begin,
|
||||
intervalSec, approxPointsCount, token).ConfigureAwait(false);
|
||||
|
||||
return Ok(content);
|
||||
|
@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudWebApi.Controllers
|
||||
{
|
||||
#nullable enable
|
||||
/// <summary>
|
||||
/// Расписание бурильщиков
|
||||
/// </summary>
|
||||
@ -32,12 +33,12 @@ namespace AsbCloudWebApi.Controllers
|
||||
/// <param name="token"></param>
|
||||
/// <returns>бурильщик</returns>
|
||||
[HttpGet("driller")]
|
||||
public async Task<ActionResult<DrillerDto>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
||||
public async Task<ActionResult<DrillerDto?>> GetDrillerAsync(int idWell, DateTime workTime, CancellationToken token)
|
||||
{
|
||||
if (!await UserHasAccesToWellAsync(idWell, token))
|
||||
return Forbid();
|
||||
|
||||
var result = await scheduleService.GetDrillerAsync(idWell, workTime, token);
|
||||
var result = await scheduleService.GetOrDefaultDrillerAsync(idWell, workTime, token);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user