This commit is contained in:
ai.astrakhantsev 2022-09-13 15:45:15 +05:00 committed by ngfrolov
parent 4cbe71f8ca
commit 026cde1514

View File

@ -89,10 +89,10 @@ namespace AsbCloudInfrastructure.Services
.ConfigureAwait(false); .ConfigureAwait(false);
var entitiesGroups = entities var entitiesGroups = entities
.GroupBy(d => d.Category); .GroupBy(d => d.IdCategory);
var categoriesIds = entitiesGroups var categoriesIds = entitiesGroups
.Select(g => g.Key.Id); .Select(g => g.Key);
var files = (await fileService var files = (await fileService
.GetInfosByWellIdAsync(idWell, token) .GetInfosByWellIdAsync(idWell, token)
@ -102,15 +102,15 @@ namespace AsbCloudInfrastructure.Services
var docs = entitiesGroups.Select((g) => new WellFinalDocumentDto var docs = entitiesGroups.Select((g) => new WellFinalDocumentDto
{ {
IdCategory = g.Key.Id, IdCategory = g.Key,
FilesCount = files FilesCount = files
.Where(f => f.IdCategory == g.Key.Id) .Where(f => f.IdCategory == g.Key)
.Count(), .Count(),
File = files File = files
.Where(f => f.IdCategory == g.Key.Id) .Where(f => f.IdCategory == g.Key)
.OrderBy(f => f.UploadDate) .OrderBy(f => f.UploadDate)
.LastOrDefault(), .LastOrDefault(),
NameCategory = g.Key.Name, NameCategory = g.First().Category.Name,
Publishers = g.Select(i => i.User.Adapt<UserDto>()), Publishers = g.Select(i => i.User.Adapt<UserDto>()),
PermissionToUpload = g.Any(i => i.IdUser == idUser), PermissionToUpload = g.Any(i => i.IdUser == idUser),
}); });