Skip to content

Commit

Permalink
Merge pull request #145 from companieshouse/IDVA6-1559-fix-incorrect-…
Browse files Browse the repository at this point in the history
…redirection-bug

Incorrect Redirects
  • Loading branch information
krishna-patel-ch authored Sep 9, 2024
2 parents 3f3df40 + 29d368c commit 27465bc
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public AssociationsList daoToDto( final Page<AssociationDao> associationsList, f
final var endpointUrl = computeEndpointUrl( companyDetails );
final var users = Objects.isNull( userDetails ) ? usersService.fetchUserDetails( associationsList.stream() ) : Map.of( userDetails.getUserId(), userDetails );
final var companies = Objects.isNull( companyDetails ) ? companyService.fetchCompanyProfiles( associationsList.stream() ) : Map.of( companyDetails.getCompanyNumber(), companyDetails );
final var associations = associationsList.map( associationDao -> daoToDto( associationDao, users.getOrDefault( associationDao.getUserId(), null ), companies.get( associationDao.getCompanyNumber() ) ) );
final var associations = associationsList.map( associationDao -> {
final var user = Objects.isNull( associationDao.getUserId() ) ? null : users.getOrDefault( associationDao.getUserId(), null );
final var company = companies.get( associationDao.getCompanyNumber() );
return daoToDto( associationDao, user, company );
} );
return enrichWithMetadata( associations, endpointUrl );
}

Expand Down

0 comments on commit 27465bc

Please sign in to comment.