forked from ddrilling/AsbCloudServer
Удален не актуальный костыль.
This commit is contained in:
parent
eec40bf4b7
commit
286154692e
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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>>();
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user