Skip to content

Commit

Permalink
fix: use correct late redemption enablement key (#1132)
Browse files Browse the repository at this point in the history
Renames:

`isLateRedemptionEnabled` -> `isLateRedemptionAllowed`

I can't quite fathom how this was wrong, but it's abundantly clear in
the API serializer that the correct value should be
`isLateRedemptionAllowed`.

ENT-9259
  • Loading branch information
pwnage101 authored Jul 24, 2024
1 parent 2546895 commit 01ceb41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ const redeemablePolicies = [
{
id: 123,
subsidyExpirationDate: mockSubsidyExpirationDate,
isLateRedemptionAllowed: false,
},
{
id: 456,
subsidyExpirationDate: mockSubsidyExpirationDate,
learnerContentAssignments: [mockContentAssignment],
isLateRedemptionEnabled: true,
isLateRedemptionAllowed: true, // all it takes is one redeemable policy to turn on the late redemption feature.
},
];
const expectedTransformedPolicies = redeemablePolicies.map((policy) => ({
Expand Down Expand Up @@ -82,15 +83,18 @@ describe('useLateEnrollmentBufferDays', () => {
expect(result.current).toEqual(LATE_ENROLLMENTS_BUFFER_DAYS);
});
it('should return undefined if no late redemption is enabled', async () => {
// Copy of redeemablePolicies but no policies have late redemption allowed.
const updatedRedeemablePolicies = [
{
id: 123,
subsidyExpirationDate: mockSubsidyExpirationDate,
isLateRedemptionAllowed: false,
},
{
id: 456,
subsidyExpirationDate: mockSubsidyExpirationDate,
learnerContentAssignments: [mockContentAssignment],
isLateRedemptionAllowed: false,
},
];
const updatedExpectedTransformedPolicies = updatedRedeemablePolicies.map((policy) => ({
Expand Down
4 changes: 2 additions & 2 deletions src/components/app/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,10 +438,10 @@ export function getLateEnrollmentBufferDays(redeemablePolicies) {
return undefined;
}
const anyPolicyHasLateRedemptionEnabled = redeemablePolicies.some((policy) => (
// is_late_redemption_enabled=True on the serialized policy represents the fact that late
// is_late_redemption_allowed=True on the serialized policy represents the fact that late
// redemption has been temporarily enabled by an operator for the policy. It will toggle
// itself back to False after a finite period of time.
policy.isLateRedemptionEnabled
policy.isLateRedemptionAllowed
));
return anyPolicyHasLateRedemptionEnabled ? LATE_ENROLLMENTS_BUFFER_DAYS : undefined;
}
Expand Down

0 comments on commit 01ceb41

Please sign in to comment.