feat(report): optimize customer package purchases report by removing pagination and enhancing filter application
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m55s
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 8m55s
- Simplified the data retrieval process by eliminating pagination, allowing for all matching records to be fetched in a single request. - Improved filter application logic to streamline the report generation process. - Updated the handling of the result set to ensure compatibility with the new data retrieval method.
This commit is contained in:
@@ -205,31 +205,19 @@
|
||||
_exporting = true;
|
||||
try
|
||||
{
|
||||
var filter = BuildFilter();
|
||||
var all = new List<CustomerPackagePurchaseRollupModel>();
|
||||
const int pageSize = 500;
|
||||
var page = 1;
|
||||
long totalCount;
|
||||
|
||||
do
|
||||
{
|
||||
// PageSize=0 → همهٔ ردیفهای مطابق فیلتر، مستقل از صفحهبندی گرید
|
||||
var result = await PurchaseClient.GetCustomerPackagePurchaseRollupAsync(
|
||||
new GetCustomerPackagePurchaseRollupRequest
|
||||
{
|
||||
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState
|
||||
{
|
||||
PageNumber = page,
|
||||
PageSize = pageSize
|
||||
PageNumber = 1,
|
||||
PageSize = 0
|
||||
},
|
||||
Filter = filter
|
||||
Filter = BuildFilter()
|
||||
});
|
||||
|
||||
var batch = result?.Models?.ToList() ?? new();
|
||||
all.AddRange(batch);
|
||||
totalCount = result?.MetaData?.TotalCount ?? 0;
|
||||
page++;
|
||||
} while (all.Count < totalCount && page <= 50);
|
||||
|
||||
var all = result?.Models?.ToList() ?? new();
|
||||
if (all.Count == 0)
|
||||
{
|
||||
Snackbar.Add("دادهای برای خروجی با فیلتر فعلی وجود ندارد.", Severity.Info);
|
||||
|
||||
Reference in New Issue
Block a user