Удален не актуальный костыль.

This commit is contained in:
Frolov-Nikita 2023-08-08 12:24:44 +05:00
parent eec40bf4b7
commit 286154692e
No known key found for this signature in database
GPG Key ID: 719E3386D12B0760
4 changed files with 1 additions and 38 deletions

View File

@ -97,13 +97,6 @@ namespace AsbCloudApp.Services
/// <returns></returns>
DatesRangeDto GetDatesRange(int idWell);
/// <summary>
/// Проверить задан ли у скважины часовой пояс и задать его если он не задан
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
Task EnshureTimezonesIsSetAsync(CancellationToken token);
/// <summary>
/// ВРЕМЕННЫЙ метод
/// </summary>

View File

@ -300,26 +300,6 @@ namespace AsbCloudInfrastructure.Services
return dto;
}
public async Task EnshureTimezonesIsSetAsync(CancellationToken token)
{
var cache = await GetCacheAsync(token);
if (!cache.Any(w => w.Timezone is null))
return;
var defaultTimeZone = new SimpleTimezone
{
Hours = 5,
IsOverride = false,
TimezoneId = "Assumed",
};
await dbSet.Where(w => w.Timezone == null)
.ForEachAsync(w => w.Timezone = defaultTimeZone, token);
await dbContext.SaveChangesAsync(token);
DropCache();
}
public SimpleTimezoneDto GetTimezone(int idWell)
{
var well = GetOrDefault(idWell);

View File

@ -27,9 +27,7 @@ namespace AsbCloudInfrastructure
context.Database.SetCommandTimeout(TimeSpan.FromSeconds(2 * 60));
context.Database.Migrate();
var wellService = provider.GetRequiredService<IWellService>();
wellService.EnshureTimezonesIsSetAsync(CancellationToken.None).Wait();// TODO: make this background work
// TODO: Сделать инициализацию кеша телеметрии более явной.
_ = provider.GetRequiredService<TelemetryDataCache<TelemetryDataSaubDto>>();
_ = provider.GetRequiredService<TelemetryDataCache<TelemetryDataSpinDto>>();

View File

@ -18,13 +18,5 @@ namespace AsbCloudWebApi.Controllers
public AdminWellController(IWellService service)
: base(service)
{ }
[HttpPost("EnshureTimezonesIsSet")]
[Permission]
public async Task<IActionResult> EnshureTimezonesIsSet(CancellationToken token)
{
await ((IWellService)service).EnshureTimezonesIsSetAsync(token);
return Ok();
}
}
}