Фикс бага неполного экспорта ГГД

This commit is contained in:
Olga Nemt 2024-05-06 10:49:47 +05:00
parent 9006e1e36c
commit 89278819cc
2 changed files with 11 additions and 14 deletions

View File

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

View File

@ -43,8 +43,6 @@ public class WellOperationExport<TTemplate> : ExcelExportService<WellOperationDt
var request = new WellOperationRequest(new[] { options.IdWell })
{
OperationType = options.IdType,
Skip = 0,
Take = 1000000,
};
return wellOperationRepository.GetAsync(request, token);