Skip to content

Commit

Permalink
feat: Add course_revision number as Course Version to the outline…
Browse files Browse the repository at this point in the history
… page.

Needed a way to apply a version number to a course to ensure that the learner has a specific version of the course.

This was a request from the `Choose Aerospace` administers to ensure that the schools are using the latest version.

Adding this number into the course is found on the Schedule & Details page Course Details section (new field highlighted below).
  • Loading branch information
becdavid committed Jan 23, 2024
1 parent a141601 commit bc87d76
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/course-home/data/__snapshots__/redux.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ Object {
"url": "https://example.com/bookmarks",
},
],
"courseRevision": "2023.10",
"datesBannerInfo": Object {
"contentTypeGatingEnabled": false,
"missedDeadlines": false,
Expand Down
2 changes: 2 additions & 0 deletions src/course-home/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ export async function getOutlineTabData(courseId) {
const courseBlocks = data.course_blocks ? normalizeOutlineBlocks(courseId, data.course_blocks.blocks) : {};
const courseGoals = camelCaseObject(data.course_goals);
const courseTools = camelCaseObject(data.course_tools);
const courseRevision = camelCaseObject(data.course_revision);
const datesBannerInfo = camelCaseObject(data.dates_banner_info);
const datesWidget = camelCaseObject(data.dates_widget);
const enableProctoredExams = data.enable_proctored_exams;
Expand All @@ -397,6 +398,7 @@ export async function getOutlineTabData(courseId) {
courseBlocks,
courseGoals,
courseTools,
courseRevision,
datesBannerInfo,
datesWidget,
enrollAlert,
Expand Down
8 changes: 7 additions & 1 deletion src/course-home/outline-tab/OutlineTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AlertList } from '../../generic/user-messages';

import CourseDates from './widgets/CourseDates';
import CourseHandouts from './widgets/CourseHandouts';
import CourseRevision from './widgets/CourseRevision';
import StartOrResumeCourseCard from './widgets/StartOrResumeCourseCard';
import WeeklyLearningGoalCard from './widgets/WeeklyLearningGoalCard';
import CourseTools from './widgets/CourseTools';
Expand Down Expand Up @@ -207,7 +208,12 @@ function OutlineTab({ intl }) {
/** [MM-P2P] Experiment */
mmp2p={MMP2P}
/>
<CourseHandouts />
<CourseHandouts
courseId={courseId}
/>
<CourseRevision
courseId={courseId}
/>
</div>
)}
</div>
Expand Down
4 changes: 4 additions & 0 deletions src/course-home/outline-tab/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ const messages = defineMessages({
defaultMessage: 'Resume course',
description: 'Anchor text for button that would resume course',
},
revision: {
id: 'learning.outline.revision',
defaultMessage: 'Course Version',
},
setGoal: {
id: 'learning.outline.setGoal',
defaultMessage: 'To start, set a course goal by selecting the option below that best describes your learning plan.',
Expand Down
31 changes: 31 additions & 0 deletions src/course-home/outline-tab/widgets/CourseRevision.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';
import PropTypes from 'prop-types';

import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';

import messages from '../messages';
import { useModel } from '../../../generic/model-store';

function CourseRevision({ courseId, intl }) {
const {
courseRevision,
} = useModel('outline', courseId);

if (!courseRevision) {
return null;
}

return (
<section className="mb-4">
<h2 className="h4">{intl.formatMessage(messages.revision)}</h2>
<span>{courseRevision}</span>
</section>
);
}

CourseRevision.propTypes = {
courseId: PropTypes.string.isRequired,
intl: intlShape.isRequired,
};

export default injectIntl(CourseRevision);

0 comments on commit bc87d76

Please sign in to comment.