From 673943c5fb0dec7d23be04571940ca84c0d99d81 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 12:51:55 -0400 Subject: [PATCH 1/7] chore: remove console.logs --- src/components/EnterpriseApp/EnterpriseAppRoutes.jsx | 1 - src/components/EnterpriseApp/index.jsx | 6 +----- .../learner-credit-management/AssignmentStatusTableCell.jsx | 3 ++- .../learner-credit-management/BudgetDetailPage.jsx | 2 -- .../learner-credit-management/BudgetDetailTabsAndRoutes.jsx | 3 --- .../search/CatalogSearchResults.jsx | 1 - 6 files changed, 3 insertions(+), 13 deletions(-) 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 ( { 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 mostRecentAction = actions[actions.length - 1]; // API returns actions in chronological order. + const isBadEmailError = mostRecentAction.actionType === 'notified' && !!mostRecentAction.errorReason; if (isBadEmailError) { 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/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( () => [ { From 0e526c4db26af3e19fcc8f182cc4a859dde69986 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 12:55:10 -0400 Subject: [PATCH 2/7] chore: update tests to account for multiple actions --- .../tests/BudgetDetailPage.test.jsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx index 462b32d46c..3ae945735f 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', }; - const mockFailedLinkedLearnerAction = { ...mockFailedNotifiedAction, actionType: 'learner_linked', @@ -419,7 +423,7 @@ 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], }, { learnerState: 'waiting', @@ -427,7 +431,7 @@ 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], }, { learnerState: 'failed', @@ -435,7 +439,7 @@ 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], }, { learnerState: 'failed', @@ -443,7 +447,7 @@ 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], }, { learnerState: 'failed', From 5138adb869c3f226d1417cf0f09a54d9bee29585 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 12:56:07 -0400 Subject: [PATCH 3/7] chore: remove newline --- .../learner-credit-management/AssignmentStatusTableCell.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/learner-credit-management/AssignmentStatusTableCell.jsx b/src/components/learner-credit-management/AssignmentStatusTableCell.jsx index 6e32e449dc..1e198b4ab4 100644 --- a/src/components/learner-credit-management/AssignmentStatusTableCell.jsx +++ b/src/components/learner-credit-management/AssignmentStatusTableCell.jsx @@ -32,9 +32,7 @@ const AssignmentStatusTableCell = ({ row }) => { // Determine the failure reason based on the actions. const { actions } = row.original; const mostRecentAction = actions[actions.length - 1]; // API returns actions in chronological order. - const isBadEmailError = mostRecentAction.actionType === 'notified' && !!mostRecentAction.errorReason; - if (isBadEmailError) { return ( From 04c759ccfe88396309ad4f870d04f92570379c40 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 18:49:01 -0400 Subject: [PATCH 4/7] fix: rely on error_reason returned on assignment record --- .../AssignmentStatusTableCell.jsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/learner-credit-management/AssignmentStatusTableCell.jsx b/src/components/learner-credit-management/AssignmentStatusTableCell.jsx index 1e198b4ab4..dbfc2c375a 100644 --- a/src/components/learner-credit-management/AssignmentStatusTableCell.jsx +++ b/src/components/learner-credit-management/AssignmentStatusTableCell.jsx @@ -9,13 +9,19 @@ import FailedBadEmail from './assignments-status-chips/FailedBadEmail'; import FailedSystem from './assignments-status-chips/FailedSystem'; const AssignmentStatusTableCell = ({ row }) => { - 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,11 +35,8 @@ const AssignmentStatusTableCell = ({ row }) => { } if (learnerState === 'failed') { - // Determine the failure reason based on the actions. - const { actions } = row.original; - const mostRecentAction = actions[actions.length - 1]; // API returns actions in 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 ( ); @@ -51,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, From 13dd8cc91c8e2374077bfaafb5a81c8b9502d80c Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 19:23:31 -0400 Subject: [PATCH 5/7] chore: update tests --- .../tests/BudgetDetailPage.test.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx index 3ae945735f..c0e58ac6d8 100644 --- a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx +++ b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx @@ -306,6 +306,7 @@ describe('', () => { learnerState: 'waiting', recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions: [mockSuccessfulNotifiedAction], + errorReason: null, }, ], numPages: 1, @@ -377,6 +378,7 @@ describe('', () => { learnerState: 'waiting', recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions: [mockSuccessfulNotifiedAction], + errorReason: null, }, ], numPages: 1, @@ -408,6 +410,7 @@ describe('', () => { expectedModalPopupHeading: `Notifying ${mockLearnerEmail}`, expectedModalPopupContent: `Our system is busy emailing ${mockLearnerEmail}!`, actions: [], + errorReason: null, }, { learnerState: 'notifying', @@ -416,6 +419,7 @@ describe('', () => { expectedModalPopupHeading: 'Notifying learner', expectedModalPopupContent: 'Our system is busy emailing the learner!', actions: [], + errorReason: null, }, { learnerState: 'waiting', @@ -424,6 +428,7 @@ describe('', () => { expectedModalPopupHeading: `Waiting for ${mockLearnerEmail}`, expectedModalPopupContent: 'This learner must create an edX account and complete enrollment in the course', actions: [mockSuccessfulLinkedLearnerAction, mockSuccessfulNotifiedAction], + errorReason: null, }, { learnerState: 'waiting', @@ -432,6 +437,7 @@ describe('', () => { expectedModalPopupHeading: 'Waiting for learner', expectedModalPopupContent: 'This learner must create an edX account and complete enrollment in the course', actions: [mockSuccessfulLinkedLearnerAction, mockSuccessfulNotifiedAction], + errorReason: null, }, { learnerState: 'failed', @@ -440,6 +446,7 @@ describe('', () => { expectedModalPopupHeading: 'Failed: Bad email', expectedModalPopupContent: `This course assignment failed because a notification to ${mockLearnerEmail} could not be sent.`, actions: [mockSuccessfulLinkedLearnerAction, mockFailedNotifiedAction], + errorReason: 'email_error', }, { learnerState: 'failed', @@ -448,6 +455,7 @@ describe('', () => { expectedModalPopupHeading: 'Failed: Bad email', expectedModalPopupContent: 'This course assignment failed because a notification to the learner could not be sent.', actions: [mockSuccessfulLinkedLearnerAction, mockFailedNotifiedAction], + errorReason: 'email_error', }, { learnerState: 'failed', @@ -456,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, @@ -464,6 +473,7 @@ describe('', () => { expectedModalPopupHeading, expectedModalPopupContent, actions, + errorReason, }) => { useParams.mockReturnValue({ budgetId: mockSubsidyAccessPolicyUUID, @@ -493,6 +503,7 @@ describe('', () => { learnerState, recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions, + errorReason, }, ], numPages: 1, @@ -761,6 +772,7 @@ describe('', () => { learnerState: 'active', recentAction: { actionType: 'assigned', timestamp: '2023-10-27' }, actions: [], + errorReason: null, state: 'allocated', }, ], From dad9642b018bca8e6a9fb135921f5642b438c86e Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 19:24:52 -0400 Subject: [PATCH 6/7] chore: use email_error instead of bad_email --- .../learner-credit-management/tests/BudgetDetailPage.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx index c0e58ac6d8..1be7a7488a 100644 --- a/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx +++ b/src/components/learner-credit-management/tests/BudgetDetailPage.test.jsx @@ -87,7 +87,7 @@ const mockSuccessfulLinkedLearnerAction = { const mockFailedNotifiedAction = { ...mockSuccessfulNotifiedAction, completedAt: null, - errorReason: 'bad_email', + errorReason: 'email_error', }; const mockFailedLinkedLearnerAction = { ...mockFailedNotifiedAction, From 5909068adde381b3148e880da1e41b179da268a6 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 1 Nov 2023 22:12:44 -0400 Subject: [PATCH 7/7] chore: remove copy --- .../learner-credit-management/cards/Collapsibles.jsx | 4 ---- 1 file changed, 4 deletions(-) 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. -