Skip to content

Commit

Permalink
revert: "Merge pull request #95 from Pearson-Advance/vue/PADV-1412"
Browse files Browse the repository at this point in the history
This reverts commit c5c9311, reversing
changes made to 8df2c99.
  • Loading branch information
01001110J committed Jun 20, 2024
1 parent c5c9311 commit 2fcf9ca
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/features/Courses/CourseDetailTable/__test__/columns.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('columns', () => {
});

renderWithProviders(
<MemoryRouter initialEntries={['/courses/course-v1:USB+CDDD+2023']}>
<MemoryRouter initialEntries={['/courses/Demo%20Course%201']}>
<Route path="/courses/:courseId">
<Component />
</Route>
Expand All @@ -73,7 +73,7 @@ describe('columns', () => {
const linkElement = screen.getByText('Class example');
expect(linkElement).toBeInTheDocument();
expect(linkElement).toHaveClass('text-truncate link');
expect(linkElement).toHaveAttribute('href', '/courses/course-v1:USB+CDDD+2023/Class example?classId=class id&previous=courses');
expect(linkElement).toHaveAttribute('href', '/courses/Demo Course 1/Class example?classId=class id&previous=courses');
});

test('Should render the dates', () => {
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('columns', () => {
};

const component = renderWithProviders(
<MemoryRouter initialEntries={['/courses/course-v1:USB+CDDD+2023']}>
<MemoryRouter initialEntries={['/courses/Demo%20Course%201']}>
<Route path="/courses/:courseId">
<Component />
</Route>
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('columns', () => {
};

const component = renderWithProviders(
<MemoryRouter initialEntries={['/courses/course-v1:USB+CDDD+2023']}>
<MemoryRouter initialEntries={['/courses/Demo%20Course%201']}>
<Route path="/courses/:courseId">
<ComponentNoInstructor />
</Route>
Expand Down Expand Up @@ -255,7 +255,7 @@ describe('columns', () => {
};

const component = renderWithProviders(
<MemoryRouter initialEntries={['/courses/course-v1:USB+CDDD+2023']}>
<MemoryRouter initialEntries={['/courses/Demo%20Course%201']}>
<Route path="/courses/:courseId">
<Component />
</Route>
Expand Down
10 changes: 5 additions & 5 deletions src/features/Courses/CoursesDetailPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ const CoursesDetailPage = () => {
numberOfStudents: '-',
numberOfPendingStudents: '-',
masterCourseId: '-',
masterCourseName: '-',
};

const courseInfo = useSelector((state) => state.courses.table.data)
.find((course) => course?.masterCourseId === courseId) || defaultCourseInfo;
.find((course) => course?.masterCourseName === courseId) || defaultCourseInfo;
const institution = useSelector((state) => state.main.selectedInstitution);
const classes = useSelector((state) => state.classes.table);
const totalStudents = courseInfo.numberOfStudents + courseInfo.numberOfPendingStudents;
const courseDetailsLink = `${getConfig().LEARNING_MICROFRONTEND_URL}/course/${courseInfo.masterCourseId}/home`;

const handlePagination = (targetPage) => {
setCurrentPage(targetPage);
dispatch(updateCurrentPage(targetPage));
Expand All @@ -51,18 +51,18 @@ const CoursesDetailPage = () => {
};

if (institution.id) {
dispatch(fetchClassesData(institution.id, initialPage, courseInfo.masterCourseName));
dispatch(fetchClassesData(institution.id, initialPage, courseId));
dispatch(fetchCoursesData(institution.id, initialPage, null));
}

return () => {
dispatch(fetchCoursesDataSuccess(initialState));
dispatch(fetchClassesDataSuccess(initialState));
};
}, [dispatch, institution.id, courseId]); // eslint-disable-line react-hooks/exhaustive-deps
}, [dispatch, institution.id, courseId]);

useEffect(() => {
dispatch(fetchClassesData(institution.id, currentPage, courseInfo.masterCourseName));
dispatch(fetchClassesData(institution.id, currentPage, courseId));
}, [currentPage]); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/features/Courses/CoursesTable/columns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const columns = [
{
Header: 'Courses',
accessor: 'masterCourseName',
Cell: ({ row }) => (<Link to={`/courses/${row.original.masterCourseId}`} className="link">{row.values.masterCourseName}</Link>),
Cell: ({ row }) => (<Link to={`/courses/${row.values.masterCourseName}`} className="link">{row.values.masterCourseName}</Link>),
},
{
Header: 'Classes',
Expand Down
2 changes: 1 addition & 1 deletion src/features/Licenses/LicenseDetailTable/columns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const columns = [
Header: 'Course',
accessor: 'masterCourseName',
Cell: ({ row }) => (
<Link to={`/courses/${row.original.masterCourseId}`} className="link">{row.values.masterCourseName}</Link>
<Link to={`/courses/${row.values.masterCourseName}`} className="link">{row.values.masterCourseName}</Link>
),
},
{
Expand Down

0 comments on commit 2fcf9ca

Please sign in to comment.