From c522d68191c55900aabeb89431761a441593ff2e Mon Sep 17 00:00:00 2001
From: jajjibhai008
Date: Mon, 4 Dec 2023 12:43:51 +0500
Subject: [PATCH 1/2] fix: conditionally text rendering while exec-ed course
enrollments
---
.../course/routes/ExternalCourseEnrollment.jsx | 13 +++++++++++--
.../routes/ExternalCourseEnrollmentConfirmation.jsx | 10 ++++++++--
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/components/course/routes/ExternalCourseEnrollment.jsx b/src/components/course/routes/ExternalCourseEnrollment.jsx
index 00d2739ad2..3d38f99130 100644
--- a/src/components/course/routes/ExternalCourseEnrollment.jsx
+++ b/src/components/course/routes/ExternalCourseEnrollment.jsx
@@ -12,8 +12,10 @@ import { CourseContext } from '../CourseContextProvider';
import CourseSummaryCard from '../../executive-education-2u/components/CourseSummaryCard';
import RegistrationSummaryCard from '../../executive-education-2u/components/RegistrationSummaryCard';
import UserEnrollmentForm from '../../executive-education-2u/UserEnrollmentForm';
-import { useExternalEnrollmentFailureReason, useMinimalCourseMetadata } from '../data/hooks';
+import { useExternalEnrollmentFailureReason, useIsCourseAssigned, useMinimalCourseMetadata } from '../data/hooks';
import ErrorPageContent from '../../executive-education-2u/components/ErrorPageContent';
+import { UserSubsidyContext } from '../../enterprise-user-subsidy';
+import { features } from '../../../config';
const ExternalCourseEnrollment = () => {
const config = getConfig();
@@ -22,14 +24,19 @@ const ExternalCourseEnrollment = () => {
state: {
activeCourseRun,
courseEntitlementProductSku,
+ course,
},
userSubsidyApplicableToCourse,
hasSuccessfulRedemption,
externalCourseFormSubmissionError,
} = useContext(CourseContext);
+ const {
+ redeemableLearnerCreditPolicies,
+ } = useContext(UserSubsidyContext);
const {
enterpriseConfig: { authOrgId },
} = useContext(AppContext);
+ const isCourseAssigned = useIsCourseAssigned(redeemableLearnerCreditPolicies, course?.key);
const courseMetadata = useMinimalCourseMetadata();
@@ -106,7 +113,9 @@ const ExternalCourseEnrollment = () => {
Please ensure that the course details below are correct and confirm using Learner
Credit with a "Confirm registration" button.
- Your Learner Credit funds will be redeemed at this point.
+ {(features.FEATURE_ENABLE_TOP_DOWN_ASSIGNMENT && isCourseAssigned)
+ ? 'Your learning administrator already allocated funds towards this registration.'
+ : 'Your Learner Credit funds will be redeemed at this point.'}
)}
diff --git a/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx b/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx
index 4bcd1f61ec..d63c47f0e2 100644
--- a/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx
+++ b/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx
@@ -1,13 +1,19 @@
-import React from 'react';
+import { React, useContext } from 'react';
import { Container } from '@edx/paragon';
import { useExternalEnrollmentFailureReason, useMinimalCourseMetadata } from '../data/hooks';
import CourseSummaryCard from '../../executive-education-2u/components/CourseSummaryCard';
import EnrollmentCompletedSummaryCard from '../../executive-education-2u/components/EnrollmentCompletedSummaryCard';
import ErrorPageContent from '../../executive-education-2u/components/ErrorPageContent';
+import { CourseContext } from '../CourseContextProvider';
const ExternalCourseEnrollmentConfirmation = () => {
const courseMetadata = useMinimalCourseMetadata();
+ const {
+ state: {
+ course,
+ },
+ } = useContext(CourseContext);
const {
failureReason,
failureMessage,
@@ -28,7 +34,7 @@ const ExternalCourseEnrollmentConfirmation = () => {
courseMetadata={courseMetadata}
enrollmentCompleted
/>
-
+
)}
From 3b4bf9c8ee777d8764aaa76ee935d9877ba37a58 Mon Sep 17 00:00:00 2001
From: jajjibhai008
Date: Mon, 4 Dec 2023 12:58:50 +0500
Subject: [PATCH 2/2] fix: failing test cases
---
.../routes/tests/ExternalCourseEnrollment.test.jsx | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/components/course/routes/tests/ExternalCourseEnrollment.test.jsx b/src/components/course/routes/tests/ExternalCourseEnrollment.test.jsx
index 6c14cc8e33..d2cc4fd746 100644
--- a/src/components/course/routes/tests/ExternalCourseEnrollment.test.jsx
+++ b/src/components/course/routes/tests/ExternalCourseEnrollment.test.jsx
@@ -8,6 +8,7 @@ import UserEnrollmentForm from '../../../executive-education-2u/UserEnrollmentFo
import ExternalCourseEnrollment from '../ExternalCourseEnrollment';
import { CourseContext } from '../../CourseContextProvider';
import { DISABLED_ENROLL_REASON_TYPES, LEARNER_CREDIT_SUBSIDY_TYPE } from '../../data/constants';
+import { UserSubsidyContext } from '../../../enterprise-user-subsidy';
const mockHistoryPush = jest.fn();
jest.mock('react-router-dom', () => ({
@@ -74,12 +75,15 @@ const baseAppContextValue = {
const ExternalCourseEnrollmentWrapper = ({
courseContextValue = baseCourseContextValue,
appContextValue = baseAppContextValue,
+ initialUserSubsidyState = {},
}) => (
-
-
-
+
+
+
+
+
);