Skip to content

Commit

Permalink
fix: create payment if any of the chargeable signups is attending
Browse files Browse the repository at this point in the history
  • Loading branch information
jorilindell committed Jun 7, 2024
1 parent ef389cc commit 2d67dab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/domain/signupGroup/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -841,14 +841,14 @@ describe('shouldCreatePayment', () => {
[[freeSignup], false],
[[freeSignupInWaitingList], false],
[[chargeableSignup, chargeableSignup], true],
[[chargeableSignup, chargeableSignupInWaitingList], false],
[[chargeableSignup, chargeableSignupInWaitingList], true],
[[chargeableSignup, freeSignup], true],
[[chargeableSignup, freeSignupInWaitingList], false],
[[chargeableSignup, freeSignupInWaitingList], true],
[[chargeableSignupInWaitingList, freeSignup], false],
[[chargeableSignupInWaitingList, freeSignupInWaitingList], false],
[[freeSignup, freeSignupInWaitingList], false],
])(
'should return true if any signup is chargeable and all signups are attending',
'should return true if any chargeable signup is attending',
(signups, createPayment) => {
expect(shouldCreatePayment(priceGroupOptions, signups)).toEqual(
createPayment
Expand Down
6 changes: 4 additions & 2 deletions src/domain/signupGroup/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ export const shouldCreatePayment = (
signups: SignupFormFields[]
) =>
featureFlagUtils.isFeatureEnabled('WEB_STORE_INTEGRATION') &&
calculateTotalPrice(priceGroupOptions, signups) > 0 &&
signups.every((su) => !su.inWaitingList);
calculateTotalPrice(
priceGroupOptions,
signups.filter((su) => !su.inWaitingList)
) > 0;

export const canEditSignupGroup = (signupGroup: SignupGroup) =>
signupGroup.is_created_by_current_user ||
Expand Down

0 comments on commit 2d67dab

Please sign in to comment.