fix DailyReport.MakeDefaultDailyReportAsync

This commit is contained in:
ngfrolov 2022-05-06 17:02:53 +05:00
parent 3e7a8da219
commit 8b6a9c78c7

View File

@ -52,7 +52,7 @@ namespace AsbCloudInfrastructure.Services.DailyReport
{
var dailyReportDto = await GetAsync(idWell, date, token);
if (dailyReportDto is null)
return await MakeDefaultDailyReportAsync(idWell, token);
return await MakeDefaultDailyReportAsync(idWell, date, token);
else
return dailyReportDto;
}
@ -119,13 +119,13 @@ namespace AsbCloudInfrastructure.Services.DailyReport
return Convert(entity, offsetHours);
}
private async Task<DailyReportDto> MakeDefaultDailyReportAsync(int idWell, CancellationToken token)
private async Task<DailyReportDto> MakeDefaultDailyReportAsync(int idWell, DateTime date, CancellationToken token)
{
var well = await wellService.GetAsync(idWell, token);
var offsetHours = wellService.GetTimezone(idWell).Hours;
var dto = new DailyReportDto()
{
ReportDate = DateTimeOffset.UtcNow.ToRemoteDateTime(offsetHours).Date,
ReportDate = date,
WellName = well.Caption,
ClusterName = well.Cluster,
};