Фикс получения статуса скважины

This commit is contained in:
Степанов Дмитрий 2023-10-17 12:13:00 +05:00
parent 33ac04b304
commit 4f4556b62b

View File

@ -105,18 +105,17 @@ namespace AsbCloudInfrastructure.Services
public async Task<WellMapInfoWithTelemetryStat?> GetOrDefaultStatAsync(int idWell, CancellationToken token) public async Task<WellMapInfoWithTelemetryStat?> GetOrDefaultStatAsync(int idWell, CancellationToken token)
{ {
var dto = wellInfoService.FirstOrDefault(well => well.Id == idWell); var entity = await GetOrDefaultAsync(idWell, token);
if (dto is not null)
return dto;
var request = new WellRequest{Ids = new[] { idWell }};
var entities = await GetEntitiesAsync(request, token);
var entity = entities.FirstOrDefault();
if (entity is null) if (entity is null)
return null; return null;
var dto = wellInfoService.FirstOrDefault(well => well.Id == idWell);
dto = entity.Adapt<WellMapInfoWithTelemetryStat>(); if (dto is null)
return entity.Adapt<WellMapInfoWithTelemetryStat>();
dto.IdState = entity.IdState;
return dto; return dto;
} }