diff --git a/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx b/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx index 2393795907..07b10958cb 100644 --- a/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx +++ b/src/components/EnterpriseApp/EnterpriseAppRoutes.jsx @@ -29,7 +29,6 @@ const EnterpriseAppRoutes = ({ enableContentHighlightsPage, }) => { const { canManageLearnerCredit } = useContext(EnterpriseSubsidiesContext); - console.log('EnterpriseAppRoutes!!!'); return ( { - const { original: { learnerEmail, learnerState } } = row; + const { original } = row; + const { + learnerEmail, + learnerState, + errorReason, + } = original; // Learner state is not available for this assignment, so don't display anything. if (!learnerState) { return null; } + // Display the appropriate status chip based on the learner state. if (learnerState === 'notifying') { return ( @@ -29,12 +35,8 @@ const AssignmentStatusTableCell = ({ row }) => { } if (learnerState === 'failed') { - // Determine the failure reason based on the actions. - const { actions } = row.original; - const mostRecentAction = actions[0]; // API returns actions in reverse chronological order. - const isBadEmailError = mostRecentAction.actionType === 'notified' && !!mostRecentAction.errorReason; - - if (isBadEmailError) { + // Determine which failure chip to display based on the error reason. + if (errorReason === 'email_error') { return ( ); @@ -52,6 +54,7 @@ AssignmentStatusTableCell.propTypes = { original: PropTypes.shape({ learnerEmail: PropTypes.string, learnerState: PropTypes.string.isRequired, + errorReason: PropTypes.string, actions: PropTypes.arrayOf(PropTypes.shape({ actionType: PropTypes.string.isRequired, errorReason: PropTypes.string, diff --git a/src/components/learner-credit-management/BudgetDetailPage.jsx b/src/components/learner-credit-management/BudgetDetailPage.jsx index 4591c9eee3..1ad1ff56cc 100644 --- a/src/components/learner-credit-management/BudgetDetailPage.jsx +++ b/src/components/learner-credit-management/BudgetDetailPage.jsx @@ -13,8 +13,6 @@ const BudgetDetailPage = () => { data: subsidyAccessPolicy, } = useSubsidyAccessPolicy(subsidyAccessPolicyId); - console.log('BudgetDetailPage!!!'); - if (isInitialLoadingSubsidyAccessPolicy) { return ( diff --git a/src/components/learner-credit-management/BudgetDetailTabsAndRoutes.jsx b/src/components/learner-credit-management/BudgetDetailTabsAndRoutes.jsx index 732682a35c..1d0ef0db7f 100644 --- a/src/components/learner-credit-management/BudgetDetailTabsAndRoutes.jsx +++ b/src/components/learner-credit-management/BudgetDetailTabsAndRoutes.jsx @@ -43,9 +43,6 @@ const BudgetDetailTabsAndRoutes = ({ enterpriseSlug, enterpriseFeatures, }) => { - - console.log('BudgetDetailTabsAndRoutes!!!'); - const { activeTabKey: routeActiveTabKey } = useParams(); const { budgetId, subsidyAccessPolicyId } = useBudgetId(); const { data: subsidyAccessPolicy } = useSubsidyAccessPolicy(subsidyAccessPolicyId); diff --git a/src/components/learner-credit-management/cards/Collapsibles.jsx b/src/components/learner-credit-management/cards/Collapsibles.jsx index 12d82a6be2..501b113dcf 100644 --- a/src/components/learner-credit-management/cards/Collapsibles.jsx +++ b/src/components/learner-credit-management/cards/Collapsibles.jsx @@ -20,10 +20,6 @@ export const NextStepsForAssignedLearners = ({ course }) => ( is calculated based on the course enrollment deadline or {ASSIGNMENT_ENROLLMENT_DEADLINE} days past the date of assignment, whichever is sooner. -
  • - Learners will receive automated reminder emails every 10-15 days until the enrollment - deadline is reached. -
  • diff --git a/src/components/learner-credit-management/search/CatalogSearchResults.jsx b/src/components/learner-credit-management/search/CatalogSearchResults.jsx index a256e2f5e7..fdd9bde51b 100644 --- a/src/components/learner-credit-management/search/CatalogSearchResults.jsx +++ b/src/components/learner-credit-management/search/CatalogSearchResults.jsx @@ -33,7 +33,6 @@ export const BaseCatalogSearchResults = ({ error, setNoContent, }) => { - console.log('BaseCatalogSearchResults!!!', searchResults); const courseColumns = useMemo( () => [ { diff --git a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx index 462b32d46c..1be7a7488a 100644 --- a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx +++ b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx @@ -78,13 +78,17 @@ const mockSuccessfulNotifiedAction = { completedAt: '2023-10-27', errorReason: null, }; - +const mockSuccessfulLinkedLearnerAction = { + uuid: 'test-assignment-action-uuid', + actionType: 'notified', + completedAt: '2023-10-27', + errorReason: null, +}; const mockFailedNotifiedAction = { ...mockSuccessfulNotifiedAction, completedAt: null, - errorReason: 'bad_email', + errorReason: 'email_error', }; - const mockFailedLinkedLearnerAction = { ...mockFailedNotifiedAction, actionType: 'learner_linked', @@ -302,6 +306,7 @@ describe('', () => { learnerState: 'waiting', recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions: [mockSuccessfulNotifiedAction], + errorReason: null, }, ], numPages: 1, @@ -373,6 +378,7 @@ describe('', () => { learnerState: 'waiting', recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions: [mockSuccessfulNotifiedAction], + errorReason: null, }, ], numPages: 1, @@ -404,6 +410,7 @@ describe('', () => { expectedModalPopupHeading: `Notifying ${mockLearnerEmail}`, expectedModalPopupContent: `Our system is busy emailing ${mockLearnerEmail}!`, actions: [], + errorReason: null, }, { learnerState: 'notifying', @@ -412,6 +419,7 @@ describe('', () => { expectedModalPopupHeading: 'Notifying learner', expectedModalPopupContent: 'Our system is busy emailing the learner!', actions: [], + errorReason: null, }, { learnerState: 'waiting', @@ -419,7 +427,8 @@ describe('', () => { expectedChipStatus: 'Waiting for learner', expectedModalPopupHeading: `Waiting for ${mockLearnerEmail}`, expectedModalPopupContent: 'This learner must create an edX account and complete enrollment in the course', - actions: [mockSuccessfulNotifiedAction], + actions: [mockSuccessfulLinkedLearnerAction, mockSuccessfulNotifiedAction], + errorReason: null, }, { learnerState: 'waiting', @@ -427,7 +436,8 @@ describe('', () => { expectedChipStatus: 'Waiting for learner', expectedModalPopupHeading: 'Waiting for learner', expectedModalPopupContent: 'This learner must create an edX account and complete enrollment in the course', - actions: [mockSuccessfulNotifiedAction], + actions: [mockSuccessfulLinkedLearnerAction, mockSuccessfulNotifiedAction], + errorReason: null, }, { learnerState: 'failed', @@ -435,7 +445,8 @@ describe('', () => { expectedChipStatus: 'Failed: Bad email', expectedModalPopupHeading: 'Failed: Bad email', expectedModalPopupContent: `This course assignment failed because a notification to ${mockLearnerEmail} could not be sent.`, - actions: [mockFailedNotifiedAction], + actions: [mockSuccessfulLinkedLearnerAction, mockFailedNotifiedAction], + errorReason: 'email_error', }, { learnerState: 'failed', @@ -443,7 +454,8 @@ describe('', () => { expectedChipStatus: 'Failed: Bad email', expectedModalPopupHeading: 'Failed: Bad email', expectedModalPopupContent: 'This course assignment failed because a notification to the learner could not be sent.', - actions: [mockFailedNotifiedAction], + actions: [mockSuccessfulLinkedLearnerAction, mockFailedNotifiedAction], + errorReason: 'email_error', }, { learnerState: 'failed', @@ -452,6 +464,7 @@ describe('', () => { expectedModalPopupHeading: 'Failed: System', expectedModalPopupContent: 'Something went wrong behind the scenes.', actions: [mockFailedLinkedLearnerAction], + errorReason: 'internal_api_error', }, ])('renders correct status chips with assigned table data (%s)', ({ learnerState, @@ -460,6 +473,7 @@ describe('', () => { expectedModalPopupHeading, expectedModalPopupContent, actions, + errorReason, }) => { useParams.mockReturnValue({ budgetId: mockSubsidyAccessPolicyUUID, @@ -489,6 +503,7 @@ describe('', () => { learnerState, recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions, + errorReason, }, ], numPages: 1, @@ -757,6 +772,7 @@ describe('', () => { learnerState: 'active', recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions: [], + errorReason: null, state: 'allocated', }, ],