From 1341068d206e2cf151a4c7a63263a604090cc905 Mon Sep 17 00:00:00 2001 From: Dillon Dumesnil Date: Fri, 28 Aug 2020 16:16:10 -0400 Subject: [PATCH] AA-314/AA-330: Updates to courseware due date. This will fix a bug about if assignment type is None, we will only show the due date. This will also fix a bug where we would show the assignment type and due date on non-scored units within a subsection. Now it will only show on scored units. This also fixes the pill that displays from stretching out if the due date text is multi-lined. --- .../lib/xmodule/xmodule/tests/test_vertical.py | 3 +++ common/lib/xmodule/xmodule/vertical_block.py | 1 + .../sass/course/courseware/_courseware.scss | 6 +++++- lms/templates/vert_module.html | 16 +++++++++++----- scripts/thresholds.sh | 2 +- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/common/lib/xmodule/xmodule/tests/test_vertical.py b/common/lib/xmodule/xmodule/tests/test_vertical.py index 117716b982..8f05484552 100644 --- a/common/lib/xmodule/xmodule/tests/test_vertical.py +++ b/common/lib/xmodule/xmodule/tests/test_vertical.py @@ -168,6 +168,7 @@ class VerticalBlockTestCase(BaseVerticalBlockTest): else: self.assert_bookmark_info(self.assertNotIn, html) if context: + self.assertIn("'has_assignments': True", html) self.assertIn("'subsection_format': '{}'".format(context['format']), html) self.assertIn("'completed': {}".format(completion_value == 1), html) self.assertIn("'past_due': {}".format(self.vertical.due < now), html) @@ -187,9 +188,11 @@ class VerticalBlockTestCase(BaseVerticalBlockTest): html = self.module_system.render(self.vertical, STUDENT_VIEW, self.default_context).content if has_score: + self.assertIn("'has_assignments': True", html) self.assertIn("'completed': False", html) self.assertIn("'past_due': True", html) else: + self.assertIn("'has_assignments': False", html) self.assertIn("'completed': None", html) self.assertIn("'past_due': False", html) diff --git a/common/lib/xmodule/xmodule/vertical_block.py b/common/lib/xmodule/xmodule/vertical_block.py index 11d83bec69..7912a6108f 100644 --- a/common/lib/xmodule/xmodule/vertical_block.py +++ b/common/lib/xmodule/xmodule/vertical_block.py @@ -104,6 +104,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse 'due': self.due, 'completed': completed, 'past_due': past_due, + 'has_assignments': completed is not None, 'subsection_format': context.get('format', ''), 'vertical_banner_ctas': vertical_banner_ctas, } diff --git a/lms/static/sass/course/courseware/_courseware.scss b/lms/static/sass/course/courseware/_courseware.scss index ab6b337639..de9df3eb3d 100644 --- a/lms/static/sass/course/courseware/_courseware.scss +++ b/lms/static/sass/course/courseware/_courseware.scss @@ -528,9 +528,13 @@ html.video-fullscreen { display: flex; font-size: 16px; + .localized-datetime { + max-width: 80%; + } + .pill { font-size: 12px; - + max-height: 20px; padding: 2px 8px; border-radius: 5px; margin-left: 8px; diff --git a/lms/templates/vert_module.html b/lms/templates/vert_module.html index 5b7cc4b79b..b1042a0ec8 100644 --- a/lms/templates/vert_module.html +++ b/lms/templates/vert_module.html @@ -12,17 +12,23 @@ from openedx.core.djangolib.markup import HTML

${unit_title}

% endif -% if due: - <% - data_string = _("{subsection_format} due {{date}}").format(subsection_format=subsection_format) - %> +% if has_assignments and due: + % if subsection_format: + <% + data_string = _("{subsection_format} due {{date}}").format(subsection_format=subsection_format) + %> + % else: + <% + data_string = _("Due {date}") + %> + % endif
% if completed:
${_('Completed')}
% elif past_due:
${_('Past Due')}
- %endif + % endif
% endif diff --git a/scripts/thresholds.sh b/scripts/thresholds.sh index 8a81f0d22c..b286667852 100755 --- a/scripts/thresholds.sh +++ b/scripts/thresholds.sh @@ -2,6 +2,6 @@ set -e export LOWER_PYLINT_THRESHOLD=1000 -export UPPER_PYLINT_THRESHOLD=3300 +export UPPER_PYLINT_THRESHOLD=2560 export ESLINT_THRESHOLD=5530 export STYLELINT_THRESHOLD=880