MOBILE-4616 reports: Fix load more calculation

main
Dani Palou 2024-10-09 15:31:55 +02:00
parent 3b55e699aa
commit 694d46c99c
1 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ export class CoreReportBuilderReportDetailComponent implements OnInit {
new BehaviorSubject<CoreReportBuilderReportDetailState>({ new BehaviorSubject<CoreReportBuilderReportDetailState>({
report: null, report: null,
loaded: false, loaded: false,
canLoadMoreRows: true, canLoadMoreRows: false,
errorLoadingRows: false, errorLoadingRows: false,
cardviewShowFirstTitle: false, cardviewShowFirstTitle: false,
cardVisibleColumns: 1, cardVisibleColumns: 1,
@ -126,6 +126,7 @@ export class CoreReportBuilderReportDetailComponent implements OnInit {
report, report,
cardVisibleColumns: report.details.settingsdata.cardviewVisibleColumns, cardVisibleColumns: report.details.settingsdata.cardviewVisibleColumns,
cardviewShowFirstTitle: report.details.settingsdata.cardviewShowFirstTitle, cardviewShowFirstTitle: report.details.settingsdata.cardviewShowFirstTitle,
canLoadMoreRows: report.data.totalrowcount > report.data.rows.length,
}); });
this.logView(report); this.logView(report);
@ -175,7 +176,6 @@ export class CoreReportBuilderReportDetailComponent implements OnInit {
this.updateState({ page: 0, canLoadMoreRows: false }); this.updateState({ page: 0, canLoadMoreRows: false });
await CoreUtils.ignoreErrors(this.getReport()); await CoreUtils.ignoreErrors(this.getReport());
await ionRefresher?.complete(); await ionRefresher?.complete();
this.updateState({ canLoadMoreRows: true });
} }
/** /**
@ -225,12 +225,12 @@ export class CoreReportBuilderReportDetailComponent implements OnInit {
], ],
}, },
}, },
canLoadMoreRows: newReport.data.totalrowcount > report.data.rows.length + newReport.data.rows.length,
}); });
} catch (error) { } catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'Error loading more reports'); CoreDomUtils.showErrorModalDefault(error, 'Error loading more reports');
this.updateState({ canLoadMoreRows: false }); this.updateState({ canLoadMoreRows: false, errorLoadingRows: true });
this.updateState({ errorLoadingRows: true });
} }
complete(); complete();