-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: modifies logic for setting cookies on dashboard page load (#881)
* feat: modifies logic for setting cookies on dashboard page load * chore: tests * chore: cleanup * fix: typo in test name * chore: PR fixes with corresponding tests * chore: pr cleanup * chore: PR fixes * chore: PR cleanup * chore: more PR fixes * fix: added failsafe default value for undefined 'assignments' * chore: redundant logic removed
- Loading branch information
1 parent
499191f
commit d77b948
Showing
8 changed files
with
154 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ASSIGNMENT_TYPES } from '../../enterprise-user-subsidy/enterprise-offers/data/constants'; | ||
|
||
/** | ||
* Takes the flattened array from redeemableLearnerCreditPolicies and returns the options of | ||
* the array of activeAssignments, or hasActiveAssignments which returns a boolean value | ||
* @param assignments - flatMap'ed object from redeemableLearnerCreditPolicies for learnerContentAssignments | ||
* @returns {{hasActiveAssignments: boolean, activeAssignments: Array}} | ||
*/ | ||
export default function getActiveAssignments(assignments = []) { | ||
const activeAssignments = assignments.filter((assignment) => [ | ||
ASSIGNMENT_TYPES.CANCELLED, ASSIGNMENT_TYPES.ALLOCATED, | ||
].includes(assignment.state)); | ||
const hasActiveAssignments = activeAssignments.length > 0; | ||
return { | ||
activeAssignments, | ||
hasActiveAssignments, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 25 additions & 10 deletions
35
src/components/enterprise-redirects/EnterpriseLearnerFirstVisitRedirect.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.