Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM-824: benefit plan picker update to list all types #96

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const BENEFICIARY_STATUS_LIST = [
export const BENEFIT_PLAN_TYPE = {
INDIVIDUAL: 'INDIVIDUAL',
GROUP: 'GROUP',
EVERY_TYPE: 'EVERY_TYPE',
};

export const BENEFIT_PLAN_TYPE_LIST = [BENEFIT_PLAN_TYPE.INDIVIDUAL, BENEFIT_PLAN_TYPE.GROUP];
Expand Down
10 changes: 7 additions & 3 deletions src/pickers/BenefitPlanPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ function BenefitPlanPicker(props) {
{ skip: true },
);

const benefitPlans = data?.benefitPlan?.edges
.map((edge) => edge.node)
.filter((node) => node.type === type) ?? [];
let benefitPlans = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it be refactored to:
`let benefitPlans = [];

const edges = data?.benefitPlan?.edges?.map(edge => edge.node) ?? [];

if (type === BENEFIT_PLAN_TYPE.EVERY_TYPE) {
benefitPlans = edges;
} else {
benefitPlans = edges.filter(node => node.type === type);
}`

const edges = data?.benefitPlan?.edges?.map((edge) => edge.node) ?? [];
if (type === BENEFIT_PLAN_TYPE.EVERY_TYPE) {
benefitPlans = edges;
} else {
benefitPlans = edges.filter((node) => node.type === type);
}
const shouldShowTooltip = benefitPlans?.length >= BENEFIT_PLANS_QUANTITY_LIMIT && !value && !currentString;

return (
Expand Down
Loading