Skip to content

Commit

Permalink
Merge pull request #43 from openimis/feature/ONI-252
Browse files Browse the repository at this point in the history
ONI-252: do not return policy uuid if do not exist
  • Loading branch information
delcroip authored Mar 8, 2024
2 parents 2a6fdf7 + e9fedbe commit 82b62f7
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/components/PoliciesPremiumsOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,21 @@ class PoliciesPremiumsOverview extends PagedDataHandler {
}

queryPrms = () => {
let prms = [`orderBy: "${this.state.orderBy}"`];
if (!!this.props.policy) {
prms.push(`policyUuids: ${JSON.stringify([this.props.policy.policyUuid])}`);
return prms;
} else if (!!this.props.policies && !!this.props.policies.length) {
prms.push(`policyUuids: ${JSON.stringify((this.props.policies || []).map(p => p.policyUuid))}`);
return prms;
const { policy, policies } = this.props;
const { orderBy } = this.state;

if (policy) {
return [
`orderBy: "${orderBy}"`,
`policyUuids: ${JSON.stringify([policy.policyUuid])}`,
];
} else if (policies?.length) {
const policiesUuids = JSON.stringify(
policies.map((policy) => policy.policyUuid)
);
return [`orderBy: "${orderBy}"`, `policyUuids: ${policiesUuids}`];
}

return null;
}

Expand Down

0 comments on commit 82b62f7

Please sign in to comment.