Правки по результатам теста фронтенда

This commit is contained in:
Olga Nemt 2024-03-28 11:00:55 +05:00
parent 626c3cb238
commit 3e7de2db6e
5 changed files with 12 additions and 8 deletions

View File

@ -112,7 +112,7 @@ namespace AsbCloudInfrastructure.Repository
private static TEntity Convert(Tdto dto)
{
var entity = dto.Adapt<TEntity>();
entity.UpdateDate = DateTimeOffset.Now;
entity.UpdateDate = DateTimeOffset.UtcNow;
return entity;
}
}

View File

@ -139,7 +139,9 @@ public class WellOperationRepository : IWellOperationRepository
operation.DepthEnd,
})
.First(),
});
})
.Where(s => idsWells.Contains(s.IdWell));
var dbData = await query.ToArrayAsync(token);
var sections = dbData.Select(
item => new SectionByOperationsDto
@ -163,8 +165,7 @@ public class WellOperationRepository : IWellOperationRepository
return sections;
});
var sections = cache.Where(s => idsWells.Contains(s.IdWell));
return sections;
return cache;
}
public async Task<DatesRangeDto?> GetDatesRangeAsync(int idWell, int idType, CancellationToken cancellationToken)
@ -189,6 +190,7 @@ public class WellOperationRepository : IWellOperationRepository
/// <inheritdoc/>
public DateTimeOffset? FirstOperationDate(int idWell)
{
var sections = GetSectionsAsync(new[] { idWell }, CancellationToken.None).Result;
var first = sections.FirstOrDefault(section => section.IdType == WellOperation.IdOperationTypeFact)
?? sections.FirstOrDefault(section => section.IdType == WellOperation.IdOperationTypePlan);

View File

@ -68,8 +68,6 @@ namespace AsbCloudInfrastructure.Services.SAUB
query = query.OrderByDescending(m => m.DateTime);
var timezone = telemetryService.GetTimezone(telemetry.Id);
if (request.Begin is not null)
{
var beginUtc = request.Begin.Value.ToUniversalTime();
@ -102,6 +100,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
var usersDict = users.ToDictionary(x => x.IdUser, x => x);
var messagesDtoList = new List<MessageDto>();
var timezone = telemetryService.GetTimezone(telemetry.Id);
foreach (var message in messagesList)
{

View File

@ -41,7 +41,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
public async Task<int> InsertAsync(SetpointsRequestDto setpointsRequest, CancellationToken token)
{
setpointsRequest.IdState = 1;
setpointsRequest.UploadDate = DateTime.UtcNow;
setpointsRequest.UploadDate = DateTimeOffset.UtcNow;
var result = await setpointsRepository.InsertAsync(setpointsRequest, token);
return result;
}

View File

@ -22,7 +22,10 @@ namespace AsbCloudWebApi.Converters
{
if (value is string str)
{
return DateOnly.Parse(str);
if (DateTimeOffset.TryParse(str, out DateTimeOffset dateTime))
return DateOnly.FromDateTime(dateTime.Date);
if (DateTime.TryParse(str, out DateTime date))
return DateOnly.FromDateTime(date);
}
return base.ConvertFrom(context, culture, value);
}