fix(api): исправлена ошибка при запросе заданий роботу на обновление расписаний, получали null при запросе даты следующего запуска РР в include EsppSchTypeValues
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Constants;
|
||||
using PARR.DAL.Contracts;
|
||||
using PARR.DAL.DomainModels;
|
||||
@@ -134,13 +135,17 @@ namespace PARR.DAL.TransformServices
|
||||
|
||||
public async Task<DateTimeOffset> GetNextDateAsync(Guid applicationInWorkId, DateTimeOffset lastRun)
|
||||
{
|
||||
var appInWork = await applicationsInWorkService.GetAsync(applicationInWorkId);
|
||||
var appInWork = await applicationsInWorkService.Get()
|
||||
.Include(aiw => aiw.EsppSchValues)
|
||||
.ThenInclude(esv => esv.EsppSchTypeValue)
|
||||
.ThenInclude(etv => etv!.DistributionPeriod)
|
||||
.FirstOrDefaultAsync(t => t.Id == applicationInWorkId);
|
||||
|
||||
var esppSchedule = await GetEsppScheduleAsync(applicationInWorkId);
|
||||
|
||||
if (appInWork!.IsAutoDistributionEnabled)
|
||||
{
|
||||
var period = esppSchedule!.Values.FirstOrDefault()!.Value!.DistributionPeriod;
|
||||
var period = appInWork.EsppSchValues.FirstOrDefault()?.EsppSchTypeValue?.DistributionPeriod;
|
||||
var periodType = ParseDistributionPeriodType(period!.Type);
|
||||
|
||||
return GetNextDateForDistributionRun(lastRun, periodType, period.Duration);
|
||||
|
||||
Reference in New Issue
Block a user