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;
|
_exporting = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var filter = BuildFilter();
|
// PageSize=0 → همهٔ ردیفهای مطابق فیلتر، مستقل از صفحهبندی گرید
|
||||||
var all = new List<CustomerPackagePurchaseRollupModel>();
|
var result = await PurchaseClient.GetCustomerPackagePurchaseRollupAsync(
|
||||||
const int pageSize = 500;
|
new GetCustomerPackagePurchaseRollupRequest
|
||||||
var page = 1;
|
{
|
||||||
long totalCount;
|
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
var result = await PurchaseClient.GetCustomerPackagePurchaseRollupAsync(
|
|
||||||
new GetCustomerPackagePurchaseRollupRequest
|
|
||||||
{
|
{
|
||||||
PaginationState = new CMSMicroservice.Protobuf.Protos.PaginationState
|
PageNumber = 1,
|
||||||
{
|
PageSize = 0
|
||||||
PageNumber = page,
|
},
|
||||||
PageSize = pageSize
|
Filter = BuildFilter()
|
||||||
},
|
});
|
||||||
Filter = filter
|
|
||||||
});
|
|
||||||
|
|
||||||
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)
|
if (all.Count == 0)
|
||||||
{
|
{
|
||||||
Snackbar.Add("دادهای برای خروجی با فیلتر فعلی وجود ندارد.", Severity.Info);
|
Snackbar.Add("دادهای برای خروجی با فیلتر فعلی وجود ندارد.", Severity.Info);
|
||||||
|
|||||||
Reference in New Issue
Block a user