nit improvements

This commit is contained in:
Фролов 2022-07-04 17:50:16 +05:00
parent e634094738
commit 91dd386ffc
5 changed files with 6 additions and 7 deletions

View File

@ -12,7 +12,7 @@ namespace AsbCloudDb
{ {
public static class EFExtentions public static class EFExtentions
{ {
private static System.Text.Json.JsonSerializerOptions jsonSerializerOptions = new() private static readonly System.Text.Json.JsonSerializerOptions jsonSerializerOptions = new()
{ {
AllowTrailingCommas = true, AllowTrailingCommas = true,
WriteIndented = true, WriteIndented = true,

View File

@ -122,7 +122,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
private async Task<DailyReportDto> MakeDefaultDailyReportAsync(int idWell, DateTime date, CancellationToken token) private async Task<DailyReportDto> MakeDefaultDailyReportAsync(int idWell, DateTime date, CancellationToken token)
{ {
var well = await wellService.GetOrDefaultAsync(idWell, token); var well = await wellService.GetOrDefaultAsync(idWell, token);
var offsetHours = wellService.GetTimezone(idWell).Hours;
var dto = new DailyReportDto() var dto = new DailyReportDto()
{ {
ReportDate = date, ReportDate = date,

View File

@ -68,7 +68,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
await base.StopAsync(token).ConfigureAwait(false); await base.StopAsync(token).ConfigureAwait(false);
} }
private async Task<int> DetectedAllTelemetriesAsync(IAsbCloudDbContext db, CancellationToken token) private static async Task<int> DetectedAllTelemetriesAsync(IAsbCloudDbContext db, CancellationToken token)
{ {
var lastDetectedDates = await db.DetectedOperations var lastDetectedDates = await db.DetectedOperations
.GroupBy(o => o.IdTelemetry) .GroupBy(o => o.IdTelemetry)
@ -91,7 +91,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
(outer, inner) => new (outer, inner) => new
{ {
IdTelemetry = outer, IdTelemetry = outer,
LastDate = inner.SingleOrDefault()?.LastDate, inner.SingleOrDefault()?.LastDate,
}); });
var affected = 0; var affected = 0;
foreach (var item in JounedlastDetectedDates) foreach (var item in JounedlastDetectedDates)
@ -108,7 +108,7 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
return affected; return affected;
} }
private async Task<IEnumerable<DetectedOperation>> DetectOperationsAsync(int idTelemetry, DateTimeOffset begin, IAsbCloudDbContext db, CancellationToken token) private static async Task<IEnumerable<DetectedOperation>> DetectOperationsAsync(int idTelemetry, DateTimeOffset begin, IAsbCloudDbContext db, CancellationToken token)
{ {
var query = db.TelemetryDataSaub var query = db.TelemetryDataSaub
.AsNoTracking() .AsNoTracking()

View File

@ -97,6 +97,7 @@ namespace AsbCloudWebApi.Controllers
/// Сформировать и скачать рапорт в формате excel /// Сформировать и скачать рапорт в формате excel
/// </summary> /// </summary>
/// <param name="idWell"></param> /// <param name="idWell"></param>
/// <param name="date"></param>
/// <param name="token"></param> /// <param name="token"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet("{date}/excel")] [HttpGet("{date}/excel")]

View File

@ -18,14 +18,12 @@ namespace AsbCloudWebApi.Controllers
public class DrillFlowChartController : CrudWellRelatedController<DrillFlowChartDto, IDrillFlowChartService> public class DrillFlowChartController : CrudWellRelatedController<DrillFlowChartDto, IDrillFlowChartService>
{ {
private readonly ITelemetryService telemetryService; private readonly ITelemetryService telemetryService;
private readonly IWellService wellService;
public DrillFlowChartController(IWellService wellService, IDrillFlowChartService service, public DrillFlowChartController(IWellService wellService, IDrillFlowChartService service,
ITelemetryService telemetryService) ITelemetryService telemetryService)
: base(wellService, service) : base(wellService, service)
{ {
this.telemetryService = telemetryService; this.telemetryService = telemetryService;
this.wellService = wellService;
} }
/// <summary> /// <summary>