Skip to content

Commit

Permalink
Merge pull request #31 from pagopa/PPANTT-91-fix-paging-issue
Browse files Browse the repository at this point in the history
[PPANTT-91] fix: paging issues
  • Loading branch information
alessio-cialini authored Aug 21, 2024
2 parents 089087e + 1e9d386 commit 240e19d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public ExternalServiceImpl(BrokerInstitutionsRepository brokerInstitutionsReposi
@Override
public BrokerInstitutionsResponse getBrokerInstitutions(String brokerCode, Integer limit, Integer page) {
Optional<BrokerInstitutionAggregate> brokerInstitutionsEntity = brokerInstitutionsRepository
.findPagedInstitutionsByBrokerCode(brokerCode, page == 0 ? 0 : ((page * limit) - 1), limit);
.findPagedInstitutionsByBrokerCode(brokerCode, page * limit, limit);
if (brokerInstitutionsEntity.isEmpty() ||
brokerInstitutionsEntity.get().getInstitutionEntities() == null) {
throw new AppException(AppError.BROKER_INSTITUTIONS_NOT_FOUND, brokerCode);
Expand Down Expand Up @@ -89,7 +89,7 @@ public CIIbansResponse getCIsIbans(Integer limit, Integer page) {
public CIIbansResponse getBrokerIbans(String brokerCode, Integer limit, Integer page) {
Pageable pageable = PageRequest.of(page, limit);
Optional<IbanAggregate> brokerIbanAggregate = brokerIbansRepository.getBrokerIbans(
brokerCode, page == 0 ? 0 : ((page * limit) - 1), limit);
brokerCode, page * limit, limit);
if (brokerIbanAggregate.isEmpty() ||
brokerIbanAggregate.get().getIbansSlice() == null) {
throw new AppException(AppError.BROKER_IBANS_NOT_FOUND, brokerCode);
Expand Down

0 comments on commit 240e19d

Please sign in to comment.