Commit e7f7bcda by Stephen Sanchez

Adding date time formatting.

parent 095e1f0c
......@@ -333,9 +333,16 @@ class OpenAssessmentBlock(XBlock, SubmissionMixin, PeerAssessmentMixin, SelfAsse
if not context_dict:
context_dict = {}
start = datetime.datetime.strptime(self.start_datetime, "%Y-%m-%dT%H:%M:%S")
due = datetime.datetime.strptime(self.due_datetime, "%Y-%m-%dT%H:%M:%S")
context_dict["xblock_trace"] = self.get_xblock_trace()
context_dict["rubric_instructions"] = self.rubric_instructions
context_dict["rubric_criteria"] = self.rubric_criteria
context_dict["formatted_start_date"] = start.strftime("%A, %B %d, %Y")
context_dict["formatted_start_datetime"] = start.strftime("%A, %B %d, %Y %X")
context_dict["formatted_due_date"] = due.strftime("%A, %B %d, %Y")
context_dict["formatted_due_datetime"] = due.strftime("%A, %B %d, %Y %X")
template = get_template(path)
context = Context(context_dict)
......
......@@ -96,6 +96,10 @@ class ScenarioParser(object):
def parse(self):
"""Instantiate xblock object from runtime XML definition."""
self.xblock.start_datetime = self.root.attrib.get('start', None)
self.xblock.due_datetime = self.root.attrib.get('due', None)
for child in self.root:
if child.tag == 'prompt':
self.xblock.prompt = self.get_prompt(child)
......
......@@ -17,7 +17,7 @@
<!--header class="step__header ui-toggle-visibility__control"-->
<h2 class="step__title">
<span class="step__label">Your Response</span>
<span class="step__deadline">due <span class="date">January 24, 2014</span> at <span class="time">15:00 UTC</span></span>
<span class="step__deadline">due <span class="date">{{ formatted_due_datetime }}</span>
</h2>
<span class="step__status">
......@@ -27,7 +27,7 @@
<!--/header-->
<div class="step__instruction">
<p>Please provide your response to the following question. You may save your progress and return to complete your response anytime before the due date of <span class="step__deadline">due <span class="date">January 24, 2014</span></span>. <strong class="emphasis--beta">Once you submit, you may not edit your response</strong>.</p>
<p>Please provide your response to the following question. You may save your progress and return to complete your response anytime before the due date of <span class="step__deadline">due <span class="date">{{ formatted_due_date }}</span></span>. <strong class="emphasis--beta">Once you submit, you may not edit your response</strong>.</p>
</div>
<div class="step__content">
......
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<vertical_demo>
<openassessment start="2013-12-19T23:00-7:00" due="2014-12-21T23:00-7:00">
<openassessment start="2013-02-24T13:53:50" due="2014-02-24T13:53:50">
<title>
Censorship in Public Libraries
</title>
......
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<vertical_demo>
<openassessment start="2014-12-19T23:00-7:00" due="2014-12-21T23:00-7:00">
<openassessment start="2013-02-24T13:53:50" due="2014-02-24T13:53:50">
<title>
Global Poverty
</title>
......
......@@ -53,7 +53,6 @@ class SubmissionMixin(object):
# It is an error to submit multiple times for the same item
status_tag = 'ENOMULTI'
else:
status_tag = 'ENODATA'
try:
response = api.create_submission(student_item_dict, student_sub)
except api.SubmissionRequestError, e:
......
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