Commit 5302db3a by Stephen Sanchez Committed by Will Daly

Update the due date parsing script to display properly.

Conflicts:
	apps/openassessment/xblock/peer_assessment_mixin.py
	apps/openassessment/xblock/self_assessment_mixin.py
parent a179657e
......@@ -7,6 +7,7 @@ from openassessment.assessment.peer_api import (
PeerAssessmentWorkflowError
)
import openassessment.workflow.api as workflow_api
from .resolve_dates import DISTANT_FUTURE
logger = logging.getLogger(__name__)
......@@ -137,11 +138,18 @@ class PeerAssessmentMixin(object):
path = 'openassessmentblock/peer/oa_peer_unavailable.html'
finished = False
problem_closed, reason, start_date, due_date = self.is_closed(step="peer-assessment")
context_dict = {
"rubric_criteria": self.rubric_criteria,
"estimated_time": "20 minutes" # TODO: Need to configure this.
}
# We display the due date whether the problem is open or closed.
# If no date is set, it defaults to the distant future, in which
# case we don't display the date.
if due_date < DISTANT_FUTURE:
context_dict['peer_due'] = due_date
workflow = self.get_workflow_info()
if workflow is None:
return self.render_assessment(path, context_dict)
......@@ -175,7 +183,6 @@ class PeerAssessmentMixin(object):
).format(count + 2)
if reason == 'due' and problem_closed:
context_dict["peer_due"] = due_date
path = 'openassessmentblock/peer/oa_peer_closed.html'
elif reason == 'start' and problem_closed:
context_dict["peer_start"] = start_date
......
......@@ -5,6 +5,7 @@ from xblock.core import XBlock
from openassessment.assessment import self_api
from openassessment.workflow import api as workflow_api
from submissions import api as submission_api
from .resolve_dates import DISTANT_FUTURE
logger = logging.getLogger(__name__)
......@@ -48,6 +49,12 @@ class SelfAssessmentMixin(object):
path = 'openassessmentblock/self/oa_self_unavailable.html'
problem_closed, reason, start_date, due_date = self.is_closed(step="self-assessment")
# We display the due date whether the problem is open or closed.
# If no date is set, it defaults to the distant future, in which
# case we don't display the date.
if due_date < DISTANT_FUTURE:
context['self_due'] = due_date
# If we haven't submitted yet, `workflow` will be an empty dict,
# and `workflow_status` will be None.
workflow = self.get_workflow_info()
......@@ -65,7 +72,6 @@ class SelfAssessmentMixin(object):
context["self_start"] = start_date
path = 'openassessmentblock/self/oa_self_unavailable.html'
elif reason == 'due':
context["self_due"] = due_date
path = 'openassessmentblock/self/oa_self_closed.html'
else:
submission = submission_api.get_submission(self.submission_uuid)
......
......@@ -269,7 +269,8 @@ class TestSelfAssessmentRender(XBlockHandlerTestCase):
# We're checking it anyway to be overly defensive: if the user has made a self-assessment,
# we ALWAYS show complete, even if the workflow tells us we're still have status 'self'.
self._assert_path_and_context(
xblock, 'openassessmentblock/self/oa_self_complete.html', {},
xblock, 'openassessmentblock/self/oa_self_complete.html',
{'self_due': datetime.datetime(2000, 1, 1).replace(tzinfo=pytz.utc)},
workflow_status='self',
submission_uuid=submission['uuid']
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment