Commit 1e64121e by Eric Fischer

Localize times for cancelled workflow

TNL-5267
parent 71395afb
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<p> <p>
{% trans "Enter your response to the question." %} {% trans "Enter your response to the question." %}
{% if submission_due %} {% if submission_due %}
{% trans "You can save your progress and return to complete your response at any time before the due date" %} (<span class="step__deadline"><span class="date">{{ submission_due|utc|date:"l, N j, Y H:i e" }}</span></span>). {% trans "You can save your progress and return to complete your response at any time before the due date" %} (<span class="step__deadline"><span class="date">{{ submission_due|timezone:time_zone|date:"l, N j, Y H:i e" }}</span></span>).
{% else %} {% else %}
{% trans "You can save your progress and return to complete your response at any time." %} {% trans "You can save your progress and return to complete your response at any time." %}
{% endif %} {% endif %}
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
{% trans "Your submission was cancelled. " %} {% trans "Your submission was cancelled. " %}
<p> <p>
{% if workflow_cancellation.cancelled_by %} {% if workflow_cancellation.cancelled_by %}
{% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|utc|date:"N j, Y H:i e" removed_by_username=workflow_cancellation.cancelled_by %} {% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|timezone:time_zone|date:"N j, Y H:i e" removed_by_username=workflow_cancellation.cancelled_by %}
Your submission has been cancelled by {{ removed_by_username }} on {{ removed_datetime }} Your submission has been cancelled by {{ removed_by_username }} on {{ removed_datetime }}
{% endblocktrans %} {% endblocktrans %}
{% else %} {% else %}
{% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|utc|date:"N j, Y H:i e" %} {% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|timezone:time_zone|date:"N j, Y H:i e" %}
Your submission was cancelled on {{ removed_datetime }} Your submission was cancelled on {{ removed_datetime }}
{% endblocktrans %} {% endblocktrans %}
{% endif %} {% endif %}
......
...@@ -26,11 +26,11 @@ ...@@ -26,11 +26,11 @@
{% if workflow_cancellation %} {% if workflow_cancellation %}
<p> <p>
{% if workflow_cancellation.cancelled_by %} {% if workflow_cancellation.cancelled_by %}
{% blocktrans with removed_by_username=workflow_cancellation.cancelled_by removed_datetime=workflow_cancellation.cancelled_at|utc|date:"F j, Y H:i e" %} {% blocktrans with removed_by_username=workflow_cancellation.cancelled_by removed_datetime=workflow_cancellation.cancelled_at|timezone:time_zone|date:"F j, Y H:i e" %}
Learner submission removed by {{ removed_by_username }} on {{ removed_datetime }} Learner submission removed by {{ removed_by_username }} on {{ removed_datetime }}
{% endblocktrans %} {% endblocktrans %}
{% else %} {% else %}
{% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|utc|date:"F j, Y H:i e" %} {% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|timezone:time_zone|date:"F j, Y H:i e" %}
Learner submission removed on {{ removed_datetime }} Learner submission removed on {{ removed_datetime }}
{% endblocktrans %} {% endblocktrans %}
{% endif %} {% endif %}
......
...@@ -24,6 +24,7 @@ from openassessment.assessment.api import self as self_api ...@@ -24,6 +24,7 @@ from openassessment.assessment.api import self as self_api
from openassessment.assessment.api import ai as ai_api from openassessment.assessment.api import ai as ai_api
from openassessment.workflow import api as workflow_api from openassessment.workflow import api as workflow_api
from openassessment.assessment.api import staff as staff_api from openassessment.assessment.api import staff as staff_api
from .resolve_dates import get_current_time_zone
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -322,6 +323,7 @@ class StaffAreaMixin(object): ...@@ -322,6 +323,7 @@ class StaffAreaMixin(object):
'submission': create_submission_dict(submission, self.prompts) if submission else None, 'submission': create_submission_dict(submission, self.prompts) if submission else None,
'rubric_criteria': copy.deepcopy(self.rubric_criteria_with_labels), 'rubric_criteria': copy.deepcopy(self.rubric_criteria_with_labels),
'student_username': student_username, 'student_username': student_username,
'time_zone': get_current_time_zone(self.runtime.service(self, 'user')), # localize for staff user
} }
if submission: if submission:
......
...@@ -892,7 +892,8 @@ ...@@ -892,7 +892,8 @@
"cancelled_by": "staff", "cancelled_by": "staff",
"cancelled_at": "2015-10-01T04:53", "cancelled_at": "2015-10-01T04:53",
"comments": "Cancelled!" "comments": "Cancelled!"
} },
"time_zone": "utc"
}, },
"output": "oa_staff_cancelled_submission.html" "output": "oa_staff_cancelled_submission.html"
}, },
......
...@@ -3,7 +3,7 @@ from collections import namedtuple ...@@ -3,7 +3,7 @@ from collections import namedtuple
import json import json
import datetime import datetime
import urllib import urllib
from mock import Mock, patch from mock import MagicMock, Mock, patch
from django.test.utils import override_settings from django.test.utils import override_settings
from openassessment.assessment.api import peer as peer_api from openassessment.assessment.api import peer as peer_api
...@@ -55,6 +55,10 @@ class NullUserService(object): ...@@ -55,6 +55,10 @@ class NullUserService(object):
def get_anonymous_user_id(username, _): def get_anonymous_user_id(username, _):
return username return username
@staticmethod
def get_current_user():
return MagicMock(opt_attrs={})
class TestCourseStaff(XBlockHandlerTestCase): class TestCourseStaff(XBlockHandlerTestCase):
""" """
......
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