fix(api): Исправил метод получение расписания еспп GetEsppScheduleDtoAsync

This commit is contained in:
Mikhail Trubnikov
2023-10-20 16:33:50 +10:00
parent 8822b29148
commit bff3b15936
2 changed files with 42 additions and 9 deletions

View File

@@ -35,23 +35,55 @@ namespace PARR.DAL.Services.Implementations
{
//Формирует расписание в нормальном понятном виде из БД
var configs = await GetWithSchIncludes()
.Where(t => t.EsppSchValues.Any(x => x.ApplicationsInWorkId == applicationInWorksId))
if (applicationInWorksId == new Guid("4c65475c-e11d-4147-b219-50d632fa321b"))
{
}
var schValues = await dataContext.EsppSchValues
.Include(t => t.EsppSchTypeConfig)
.ThenInclude(t => t!.EsppSchTypeSchedule)
.Include(t => t.EsppSchTypeConfig)
.ThenInclude(t=>t.EsppSchType)
.Include(t => t.EsppSchTypeValue)
.Where(t => t.ApplicationsInWorkId == applicationInWorksId)
.OrderBy(t => t.EsppSchTypeConfig!.Order)
.ToListAsync();
if (!configs.Any())
//var configs = await GetWithSchIncludes()
// .Where(t => t.EsppSchValues.Any(x => x.ApplicationsInWorkId == applicationInWorksId))
// .ToListAsync();
//if (!configs.Any())
// return null;
if (!schValues.Any())
return null;
var values = new List<EsppScheduleValDto>();
foreach (var config in configs)
//foreach (var config in configs)
//{
// var value = new EsppScheduleValDto
// {
// Order = config.Order,
// Type = config.EsppSchType!,
// Value = config.EsppSchValues.First().EsppSchTypeValue!
// };
// values.Add(value);
//}
foreach (var schValue in schValues)
{
var value = new EsppScheduleValDto
{
Order = config.Order,
Type = config.EsppSchType!,
Value = config.EsppSchValues.First().EsppSchTypeValue!
Order = schValue.EsppSchTypeConfig!.Order,
Type = schValue.EsppSchTypeConfig!.EsppSchType!,
Value = schValue.EsppSchTypeValue!
};
values.Add(value);
@@ -60,7 +92,7 @@ namespace PARR.DAL.Services.Implementations
var dto = new EsppScheduleDto
{
TypeSchedule = configs.First().EsppSchTypeSchedule!,
TypeSchedule = schValues.First().EsppSchTypeConfig!.EsppSchTypeSchedule!,
Values = values.OrderBy(t => t.Order).ToList()
};

View File

@@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<None Include="docker-compose.aihit-syncher.yml" />
<None Include="docker-compose.espp-order-loader.yml" />
<None Include="docker-compose.espp-template-sync.yml" />
<None Include="docker-compose.generator-templates.yml" />
<None Include="docker-compose.yml" />