Revert "Ora2 dates reprise"

This commit is contained in:
Dillon Dumesnil
2020-07-20 09:55:02 -07:00
committed by GitHub
parent 19f82258aa
commit 75db9b2534
9 changed files with 13 additions and 132 deletions

View File

@@ -22,7 +22,6 @@ class DateSummarySerializer(serializers.Serializer):
link = serializers.SerializerMethodField()
link_text = serializers.CharField()
title = serializers.CharField()
extra_info = serializers.CharField()
def get_learner_has_access(self, block):
learner_is_full_access = self.context.get('learner_is_full_access', False)

View File

@@ -10,7 +10,6 @@ from datetime import datetime
import pytz
import six
from crum import get_current_request
from dateutil.parser import parse as parse_date
from django.conf import settings
from django.http import Http404, QueryDict
from django.urls import reverse
@@ -72,7 +71,7 @@ log = logging.getLogger(__name__)
# Used by get_course_assignments below. You shouldn't need to use this type directly.
_Assignment = namedtuple(
'Assignment', ['block_key', 'title', 'url', 'date', 'contains_gated_content', 'complete', 'past_due',
'assignment_type', 'extra_info']
'assignment_type']
)
@@ -509,7 +508,6 @@ def get_course_assignment_date_blocks(course, user, request, num_return=None,
date_block.past_due = assignment.past_due
date_block.link = request.build_absolute_uri(assignment.url) if assignment.url else ''
date_block.set_title(assignment.title, link=assignment.url)
date_block._extra_info = assignment.extra_info
date_blocks.append(date_block)
date_blocks = sorted((b for b in date_blocks if b.is_enabled or include_past_dates), key=date_block_key_fn)
if num_return:
@@ -553,72 +551,9 @@ def get_course_assignments(course_key, user, include_access=False):
complete = is_block_structure_complete_for_assignments(block_data, subsection_key)
past_due = not complete and due < now
assignments.append(_Assignment(
subsection_key, title, url, due, contains_gated_content, complete, past_due, assignment_type, None
subsection_key, title, url, due, contains_gated_content, complete, past_due, assignment_type
))
# Load all dates for ORA blocks as separate assignments
descendents = block_data.get_children(subsection_key)
while descendents:
descendent = descendents.pop()
descendents.extend(block_data.get_children(descendent))
if block_data.get_xblock_field(descendent, 'category', None) == 'openassessment':
graded = block_data.get_xblock_field(descendent, 'graded', False)
has_score = block_data.get_xblock_field(descendent, 'has_score', False)
weight = block_data.get_xblock_field(descendent, 'weight', 1)
if not (graded and has_score and (weight is None or weight > 0)):
continue
all_assessments = [{
'name': 'submission',
'due': block_data.get_xblock_field(descendent, 'submission_due'),
'start': block_data.get_xblock_field(descendent, 'submission_start'),
'required': True
}]
valid_assessments = block_data.get_xblock_field(descendent, 'valid_assessments')
if valid_assessments:
all_assessments.extend(valid_assessments)
assignment_type = block_data.get_xblock_field(descendent, 'format', None)
complete = is_block_structure_complete_for_assignments(block_data, descendent)
block_title = block_data.get_xblock_field(descendent, 'title', _('Open Response Assessment'))
for assessment in valid_assessments:
due = parse_date(assessment['due']).replace(tzinfo=pytz.UTC) if assessment['due'] else None
if due is None:
continue
if assessment['name'] == 'self-assessment':
assessment_type = _("Self Assessment")
elif assessment['name'] == 'peer-assessment':
assessment_type = _("Peer Assessment")
elif assessment['name'] == 'staff-assessment':
assessment_type = _("Staff Assessment")
elif assessment['name'] == 'submission':
assessment_type = _("Submission")
else:
assessment_type = assessment['name']
title = "{} ({})".format(block_title, assessment_type)
url = ''
start = parse_date(assessment['start']).replace(tzinfo=pytz.UTC) if assessment['start'] else None
assignment_released = not start or start < now
if assignment_released:
url = reverse('jump_to', args=[course_key, descendent])
past_due = not complete and due and due < now
assignments.append(_Assignment(
descendent,
title,
url,
due,
contains_gated_content,
complete,
past_due,
assignment_type,
_("Open Response Assessment due dates are set by your instructor and can't be shifted.")
))
return assignments

View File

@@ -77,11 +77,6 @@ class DateSummary(object):
"""The detail text displayed by this summary."""
return ''
@property
def extra_info(self):
"""Extra detail to display as a tooltip."""
return None
def register_alerts(self, request, course):
"""
Registers any relevant course alerts given the current request.
@@ -393,7 +388,6 @@ class CourseAssignmentDate(DateSummary):
self.contains_gated_content = False
self.complete = None
self.past_due = None
self._extra_info = None
@property
def date(self):
@@ -411,10 +405,6 @@ class CourseAssignmentDate(DateSummary):
def link(self):
return self.assignment_link
@property
def extra_info(self):
return self._extra_info
@link.setter
def link(self, link):
self.assignment_link = link

View File

@@ -99,7 +99,10 @@
}
.no-access {
color: #767676;
// This is too low-contrast for a11y purposes. But since it only applies to pieces of the page that are
// inaccessible to users, and we have a banner explaining the parts that are inaccessible at the top,
// we're OK from an accessibility point of view.
color: #d1d2d4;
}
.timeline-date-content {
@@ -112,14 +115,10 @@
align-items: center;
&.not-released {
color: #b1a3a3;
color: #767676;
}
}
.timeline-date {
color: #2d323e;
}
.timeline-title {
@include font-size(14);
@@ -135,7 +134,7 @@
}
&.not-released {
color: #767676;
color: #d1d2d4;
}
}
@@ -150,30 +149,8 @@
color: #2d323e;
text-decoration: underline;
}
&.not-released {
color: #767676;
}
}
.timeline-extra-info {
@include font-size(14);
display: flex;
flex: 100%;
line-height: 1.25;
a {
color: #2d323e;
text-decoration: underline;
}
&.not-released {
color: #767676;
}
}
.pill {
@include font-size(12);

View File

@@ -82,11 +82,6 @@ from openedx.core.djangolib.markup import HTML, Text
<div class="timeline-description ${access_class} ${not_released}">
${block.description}
</div>
% if block.extra_info:
<div class="timeline-extra-info ${access_class} ${not_released}">
${block.extra_info}
</div>
% endif
% endif
</div>
</div>