Merge pull request 'Фикс бага неполного экспорта ГГД' (#273) from fix/#33063323-export-all-entries-ggd into dev

Reviewed-on: http://test.digitaldrilling.ru:8080/DDrilling/AsbCloudServer/pulls/273
This commit is contained in:
Никита Фролов 2024-05-06 12:00:14 +05:00
commit 64ffb1d116
2 changed files with 12 additions and 13 deletions

View File

@ -54,15 +54,15 @@ public class WellOperationRepository : CrudRepositoryBase<WellOperationDto, Well
public async Task<PaginationContainer<WellOperationDto>> GetPageAsync(WellOperationRequest request, CancellationToken token) public async Task<PaginationContainer<WellOperationDto>> GetPageAsync(WellOperationRequest request, CancellationToken token)
{ {
var skip = request.Skip ?? 0; request.Skip = request.Skip ?? 0;
var take = request.Take ?? 32; request.Take = request.Take ?? 32;
var (items, count) = await GetWithDaysAndNpvAsync(request, token); var (items, count) = await GetWithDaysAndNpvAsync(request, token);
var paginationContainer = new PaginationContainer<WellOperationDto> var paginationContainer = new PaginationContainer<WellOperationDto>
{ {
Skip = skip, Skip = request.Skip!.Value,
Take = take, Take = request.Take!.Value,
Count = count, Count = count,
Items = items Items = items
}; };
@ -178,9 +178,6 @@ public class WellOperationRepository : CrudRepositoryBase<WellOperationDto, Well
private async Task<(IEnumerable<WellOperationDto> items, int count)> GetWithDaysAndNpvAsync(WellOperationRequest request, CancellationToken token) private async Task<(IEnumerable<WellOperationDto> items, int count)> GetWithDaysAndNpvAsync(WellOperationRequest request, CancellationToken token)
{ {
var skip = request.Skip ?? 0;
var take = request.Take ?? 32;
var entities = await GetByIdsWells(request.IdsWell, token); var entities = await GetByIdsWells(request.IdsWell, token);
var groupedByWellAndType = entities var groupedByWellAndType = entities
.GroupBy(e => new { e.IdWell, e.IdType }); .GroupBy(e => new { e.IdWell, e.IdType });
@ -198,11 +195,14 @@ public class WellOperationRepository : CrudRepositoryBase<WellOperationDto, Well
IEnumerable<WellOperation> filteredWellOperations = FilterByRequest(wellOperationsWithType.AsQueryable(), request); IEnumerable<WellOperation> filteredWellOperations = FilterByRequest(wellOperationsWithType.AsQueryable(), request);
var filteredWellOperationsPart = filteredWellOperations count += filteredWellOperations.Count();
.Skip(skip)
.Take(take);
var dtos = filteredWellOperationsPart if (request.Skip != null)
filteredWellOperations = filteredWellOperations.Skip((int)request.Skip);
if (request.Take != null)
filteredWellOperations = filteredWellOperations.Take((int)request.Take);
var dtos = filteredWellOperations
.Select(entity => .Select(entity =>
{ {
var dto = Convert(entity); var dto = Convert(entity);
@ -214,7 +214,6 @@ public class WellOperationRepository : CrudRepositoryBase<WellOperationDto, Well
}); });
result.AddRange(dtos); result.AddRange(dtos);
count += filteredWellOperations.Count();
} }
return (result, count); return (result, count);

View File

@ -42,7 +42,7 @@ public class WellOperationExport<TTemplate> : ExcelExportService<WellOperationDt
{ {
var request = new WellOperationRequest(new[] { options.IdWell }) var request = new WellOperationRequest(new[] { options.IdWell })
{ {
OperationType = options.IdType OperationType = options.IdType,
}; };
return wellOperationRepository.GetAsync(request, token); return wellOperationRepository.GetAsync(request, token);