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.
This commit is contained in:
Dillon Dumesnil
2020-08-28 16:16:10 -04:00
parent e2069f97a2
commit 1341068d20
5 changed files with 21 additions and 7 deletions

View File

@@ -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)

View File

@@ -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,
}

View File

@@ -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;

View File

@@ -12,17 +12,23 @@ from openedx.core.djangolib.markup import HTML
<h2 class="hd hd-2 unit-title">${unit_title}</h2>
% 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
<div class="vert-due-date">
<div class="localized-datetime" data-datetime="${due}" data-string="${data_string}" data-timezone="${user_timezone}"></div>
% if completed:
<div class="pill completed">${_('Completed')}</div>
% elif past_due:
<div class="pill past-due">${_('Past Due')}</div>
%endif
% endif
</div>
% endif

View File

@@ -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