Skip to content

Commit

Permalink
Merge pull request #236 from edx/mroytman/course-best-practices-small…
Browse files Browse the repository at this point in the history
…-fixes

fix(coursechecklist): best practices copy and unit and assignment logic
  • Loading branch information
MichaelRoytman authored Jul 23, 2018
2 parents 92c10a2 + 4571cbf commit ba83eef
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/components/CourseChecklist/displayMessages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ const messages = defineMessages({
},
diverseSequencesLongDescription: {
id: 'diverseSequencesLongDescription',
defaultMessage: '90% or more of course videos are mobile friendly.',
defaultMessage: 'Research shows that a diverse content experience drives learner engagement. We recommend 80% or more of your learning sequences or subsections include multiple content types (such as video, discussion, or problem).',
description: 'Description for a section that prompts a user to follow best practices diverse sequences of educational content',
},
weekylHighlightsShortDescription: {
id: 'weekylHighlightsShortDescription',
weeklyHighlightsShortDescription: {
id: 'weeklyHighlightsShortDescription',
defaultMessage: 'Weekly Highlights',
description: 'Label for a section that describes weekly highlights',
},
weeklyHightlightsLongDescription: {
id: 'weeklyHightlightsLongDescription',
weeklyHighlightsLongDescription: {
id: 'weeklyHighlightsLongDescription',
defaultMessage: 'Weekly highlights are enabled and populated with text. These highlights keep learners engaged and on-track, no matter where they are in your course.',
description: 'Description for a section that prompts a user to follow best practices for course weekly highlights',
},
Expand Down
6 changes: 3 additions & 3 deletions src/data/i18n/default/transifex_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@
"mobileFriendlyVideoShortDescription": "Mobile Friendly Video",
"mobileFriendlyVideoLongDescription": "90% or more of course videos are mobile friendly.",
"diverseSequencesShortDescription": "Diverse Learning Sequences",
"diverseSequencesLongDescription": "90% or more of course videos are mobile friendly.",
"weekylHighlightsShortDescription": "Weekly Highlights",
"weeklyHightlightsLongDescription": "Weekly highlights are enabled and populated with text. These highlights keep learners engaged and on-track, no matter where they are in your course.",
"diverseSequencesLongDescription": "Research shows that a diverse content experience drives learner engagement. We recommend 80% or more of your learning sequences or subsections include multiple content types (such as video, discussion, or problem).",
"weeklyHighlightsShortDescription": "Weekly Highlights",
"weeklyHighlightsLongDescription": "Weekly highlights are enabled and populated with text. These highlights keep learners engaged and on-track, no matter where they are in your course.",
"unitDepthShortDescription": "Unit Depth",
"unitDepthLongDescription": "Breaking up course content into manageable pieces promotes learner engagement. We recommend units contain no more than 3 components.",
"updateLinkLabel": "Update",
Expand Down
4 changes: 3 additions & 1 deletion src/utils/CourseChecklist/courseChecklistValidators.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const hasDates = dates => (
export const hasAssignmentDeadlines = (assignments, dates) => {
if (!hasDates(dates)) {
return false;
} else if (assignments.total_number === 0) {
return false;
} else if (assignments.assignments_with_dates_before_start.length > 0) {
return false;
} else if (assignments.assignments_with_dates_after_end.length > 0) {
Expand Down Expand Up @@ -61,5 +63,5 @@ export const hasWeeklyHighlights = sections => (
);

export const hasShortUnitDepth = units => (
units.num_blocks <= 3
units.num_blocks.median <= 3
);
33 changes: 29 additions & 4 deletions src/utils/CourseChecklist/courseChecklistValidators.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('courseCheckValidators utility functions', () => {
},
)).toEqual(true);
});

it('returns false when a course run has no start and no end date', () => {
expect(validators.hasAssignmentDeadlines(
{},
Expand All @@ -88,6 +89,18 @@ describe('courseCheckValidators utility functions', () => {
)).toEqual(false);
});

it('returns false when a course has start and end date and no assignments', () => {
expect(validators.hasAssignmentDeadlines(
{
total_number: 0,
},
{
has_start_date: false,
has_end_date: false,
},
)).toEqual(false);
});

it('returns false when a course run has start and end date and assignments before start', () => {
expect(validators.hasAssignmentDeadlines(
{
Expand Down Expand Up @@ -179,12 +192,24 @@ describe('courseCheckValidators utility functions', () => {
});

describe('hasShortUnitDepth', () => {
it('returns true when course run has number of blocks <= 3', () => {
expect(validators.hasShortUnitDepth({ num_blocks: 2 })).toEqual(true);
it('returns true when course run has median number of blocks <= 3', () => {
const units = {
num_blocks: {
median: 3,
},
};

expect(validators.hasShortUnitDepth(units)).toEqual(true);
});

it('returns false when course run has number of blocks > 3', () => {
expect(validators.hasShortUnitDepth({ num_blocks: 4 })).toEqual(false);
it('returns false when course run has median number of blocks > 3', () => {
const units = {
num_blocks: {
median: 4,
},
};

expect(validators.hasShortUnitDepth(units)).toEqual(false);
});
});
});

0 comments on commit ba83eef

Please sign in to comment.