Commit 44053536 by Eric Fischer

Message Incomplete

Simplfying logic for display strings in all "user action needed" states.
parent 8cfc38ec
{% load i18n %}
{% spaceless %}
<div id="openassessment__message" class="openassessment__message message">
<h3 class="message__title">
{% trans "Assignment in progress" %}
</h3>
<div class="message__content">
<p>
{% if training %}
{% if training_deadline_approaching %}
{% trans "Learner training will close soon. Complete the learner training step to move on." %}
{% else %}
{% trans "Complete the learner training step to move on." %}
{% endif %}
{% elif self %}
{% if self_not_released %}
{% trans "Check back later when the assessment period has started." %}
{% else %}
{% with start_link='<a data-behavior="ui-scroll" href="#openassessment__self-assessment">'|safe %}
{% with start_strong='<strong>'|safe end_strong='</strong>'|safe end_link='</a>'|safe %}
{% if self_approaching %}
{% blocktrans %}
{{ start_strong }}The self assessment step will close soon.{{ end_strong }} You still need to complete the {{ start_link }}self assessment{{ end_link }} step.
{% endblocktrans %}
{% else %}
{% blocktrans %}
You still need to complete the {{ start_link }}self assessment{{ end_link }} step.
{% endblocktrans %}
{% endif %}
{% endwith %}
{% endwith %}
{% endif %}
{% elif peer %}
{% if peer_not_released %}
{% trans "Check back later when the assessment period has started." %}
{% else %}
{% with start_link='<a data-behavior="ui-scroll" href="#openassessment__peer-assessment">'|safe %}
{% with start_strong='<strong>'|safe end_strong='</strong>'|safe end_link='</a>'|safe %}
{% if peer_approaching and peer_not_available %}
{% blocktrans %}
{{ start_strong }}The peer assessment step will close soon.{{ end_strong }} All submitted peer responses have been assessed. Check back later to see if more learners have submitted responses. You still need to complete the {{ start_link }}peer assessment{{ end_link }} step.
{% endblocktrans %}
{% elif not peer_approaching and peer_not_available %}
{% blocktrans %}
All submitted peer responses have been assessed. Check back later to see if more learners have submitted responses. You still need to complete the {{ start_link }}peer assessment{{ end_link }} step.
{% endblocktrans %}
{% elif peer_approaching and not peer_not_available %}
{% blocktrans %}
{{ start_strong }}The peer assessment step will close soon.{{ end_strong }} You still need to complete the {{ start_link }}peer assessment{{ end_link }} step.
{% endblocktrans %}
{% else %}
{% blocktrans %}
You still need to complete the {{ start_link }}peer assessment{{ end_link }} step.
{% endblocktrans %}
{% endif %}
{% endwith %}
{% endwith %}
{% endif %}
{% endif %}
</p>
</div>
</div>
{% endspaceless %}
{% load i18n %}
{% spaceless %}
<div id="openassessment__message" class="openassessment__message message">
<h3 class="message__title">
{% if waiting %}
{% trans "Waiting for Peer Submissions" %}
{% elif peer_not_released %}
{% trans "The Period For Peer Evaluation Has Not Started" %}
{% else %}
{% trans "Your Response Has Been Submitted For Peer Assessment" %}
{% endif %}
</h3>
<div class="message__content">
<p>
{% if peer_not_released %}
{% trans "Check back later when the assessment period has opened." %}
{% else %}
{% if peer_approaching %}
<strong> {% trans "Peer evaluation of this assignment will close soon. " %} </strong>
{% endif %}
{% if waiting %}
{% trans "All submitted peer responses have been assessed. Check back later to see if more learners have submitted responses. " %}
{% endif %}
{% if has_self %}
{% blocktrans with peer_start_tag='<a data-behavior="ui-scroll" href="#openassessment__peer-assessment">'|safe self_start_tag='<a data-behavior="ui-scroll" href="#openassessment__self-assessment">'|safe end_tag='</a>'|safe %}
You'll receive your grade after you complete the {{ peer_start_tag }}peer assessment{{ end_tag }} and {{ self_start_tag }}self assessment{{ end_tag }} steps, and after your peers have assessed your response.
{% endblocktrans %}
{% else %}
{% blocktrans with start_tag='<a data-behavior="ui-scroll" href="#openassessment__peer-assessment">'|safe end_tag='</a>'|safe %}
You'll receive your grade after you complete the {{ start_tag }}peer assessment{{ end_tag }} step.
{% endblocktrans %}
{% endif %}
{% endif %}
</p>
</div>
</div>
{% endspaceless %}
{% load i18n %}
{% spaceless %}
<div id="openassessment__message" class="openassessment__message message">
<h3 class="message__title">
{% if self_not_released %}
{% trans "The Period For Self Evaluation Has Not Started" %}
{% elif has_peer %}
{% trans "Your Response Has Been Submitted For Peer Assessment" %}
{% else %}
{% trans "Your Response Is Ready For Self Assessment" %}
{% endif %}
</h3>
<div class="message__content">
<p>
{% if self_not_released %}
{% trans "Check back later when the assessment period has opened." %}
{% else %}
{% if self_approaching %}
<strong> {% trans "Self evaluation of this assignment will close soon. " %} </strong>
{% endif %}
{% if has_peer %}
{% blocktrans with start_tag='<a data-behavior="ui-scroll" href="#openassessment__self-assessment">'|safe end_tag='</a>'|safe %}
You'll receive your grade after the required number of your peers have assessed your response and you complete the {{ start_tag }}self assessment{{ end_tag }} step.
{% endblocktrans %}
{% else %}
{% blocktrans with start_tag='<a data-behavior="ui-scroll" href="#openassessment__self-assessment">'|safe end_tag='</a>'|safe %}
You'll receive your grade after you complete the {{ start_tag }}self assessment{{ end_tag}} step.
{% endblocktrans %}
{% endif %}
{% endif %}
</p>
</div>
</div>
{% endspaceless %}
{% load i18n %}
{% spaceless %}
<div id="openassessment__message" class="openassessment__message message">
<div class="message__content">
<p>
{% if approaching %}
{% trans "Learner training for peer assessment will close soon. " %}
{% endif %}
{% trans "Complete the learner training section to move on to peer assessment." %}
</p>
</div>
</div>
{% endspaceless %}
......@@ -40,53 +40,54 @@ class MessageMixin(object):
status = workflow.get('status')
status_details = workflow.get('status_details', {})
is_closed = deadline_info.get('general').get('is_closed')
problem_is_closed = deadline_info.get('general').get('is_closed')
# Finds the status_information which describes the closed status of the current step (defaults to submission)
status_info = deadline_info.get(status, deadline_info.get("submission"))
status_is_closed = status_info.get('is_closed')
# Default context is empty
context = {}
# Default path leads to an "instruction-unavailable" block
path = 'openassessmentblock/message/oa_message_unavailable.html'
# Finds the deadline info of the current step (defaults to submission)
active_step_deadline_info = deadline_info.get(status, deadline_info.get("submission"))
# Render the instruction message based on the status of the workflow
# and the closed status.
if status == "done" or status == "waiting":
path, context = self.render_message_complete(status_details)
elif is_closed or status_is_closed:
path, context = self.render_message_closed(status_info)
elif status == "self":
path, context = self.render_message_self(deadline_info)
elif status == "peer":
path, context = self.render_message_peer(deadline_info)
elif status == "training":
path, context = self.render_message_training(deadline_info)
elif problem_is_closed or active_step_deadline_info.get('is_closed'):
path, context = self.render_message_closed(active_step_deadline_info)
elif status == "self" or status == "peer" or status == "training":
path, context = self.render_message_incomplete(status, deadline_info)
elif status is None:
path, context = self.render_message_open(deadline_info)
else:
# Default path leads to an "instruction-unavailable" block
# Default context is empty
path, context = 'openassessmentblock/message/oa_message_unavailable.html', {}
return self.render_assessment(path, context)
def render_message_complete(self, status_details):
def render_message_incomplete(self, status, deadline_info):
"""
Renders the "Complete" message state (Either Waiting or Done)
Renders the "Incomplete" message state (User action still needed)
Args:
status (String): indicates the canonical status of the workflow
status (String): indicates the current step to be completed
deadline_info (dict): The dictionary of boolean assessment near/closed states
Returns:
The path (String) and context (dict) to render the "Complete" message template
The path (String) and context (dict) to render the "Incomplete" message template
"""
step_info = deadline_info.get(status, {})
context = {
"waiting": self.get_waiting_details(status_details),
status: True,
"{}_approaching".format(status): step_info.get('approaching', False),
"{}_not_released".format(status): (step_info.get("reason") == "start"),
#Uses a static field in the XBlock to determine if the PeerAssessment Block was able to pick up an assessment.
"peer_not_available": self.no_peers,
}
return 'openassessmentblock/message/oa_message_complete.html', context
return 'openassessmentblock/message/oa_message_incomplete.html', context
def render_message_training(self, deadline_info):
def render_message_complete(self, status_details):
"""
Renders the "Student-Training" message state (Either Waiting or Done)
Renders the "Complete" message state (Either Waiting or Done)
Args:
status (String): indicates the canonical status of the workflow
......@@ -94,14 +95,11 @@ class MessageMixin(object):
Returns:
The path (String) and context (dict) to render the "Complete" message template
"""
approaching = deadline_info.get('training').get('approaching')
context = {
'approaching': approaching
"waiting": self.get_waiting_details(status_details),
}
return 'openassessmentblock/message/oa_message_training.html', context
return 'openassessmentblock/message/oa_message_complete.html', context
def render_message_closed(self, status_info):
"""
......@@ -122,56 +120,6 @@ class MessageMixin(object):
return 'openassessmentblock/message/oa_message_closed.html', context
def render_message_self(self, deadline_info):
"""
Renders the "Self" message state
Args:
deadline_info (dict): The dictionary of boolean assessment near/closed states
Returns:
The path (String) and context (dict) to render the "Self" template
"""
has_peer = 'peer-assessment' in self.assessment_steps
self_info = deadline_info.get("self")
context = {
"has_peer": has_peer,
"self_approaching": self_info.get("approaching"),
"self_closed": self_info.get("is_closed"),
"self_not_released": (self_info.get("reason") == "start")
}
return 'openassessmentblock/message/oa_message_self.html', context
def render_message_peer(self, deadline_info):
"""
Renders the "Peer" message state
Args:
deadline_info (dict): The dictionary of boolean assessment near/closed states
Returns:
The path (String) and context (dict) to render the "Peer" template
"""
#Uses a static field in the XBlock to determine if the PeerAssessment Block was able to pick up an assessment.
waiting = self.no_peers
has_self = 'self-assessment' in self.assessment_steps
peer_info = deadline_info.get("peer")
context = {
"has_self": has_self,
"waiting": waiting,
"peer_approaching": peer_info.get("approaching"),
"peer_closed": peer_info.get("is_closed"),
"peer_not_released": (peer_info.get("reason") == "start")
}
return 'openassessmentblock/message/oa_message_peer.html', context
def render_message_open(self, deadline_info):
"""
......
......@@ -266,10 +266,13 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = True
expected_path = 'openassessmentblock/message/oa_message_training.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"approaching": False
"training": True,
"training_approaching": False,
"training_not_released": False,
"peer_not_available": False,
}
self._assert_path_and_context(
......@@ -292,10 +295,13 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = False
expected_path = 'openassessmentblock/message/oa_message_training.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"approaching": True
"training": True,
"training_approaching": True,
"training_not_released": False,
"peer_not_available": True,
}
self._assert_path_and_context(
......@@ -369,13 +375,12 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = True
expected_path = 'openassessmentblock/message/oa_message_peer.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_self": True,
"waiting": False,
"peer": True,
"peer_approaching": False,
"peer_closed": False,
"peer_not_available": False,
"peer_not_released": False
}
......@@ -397,13 +402,12 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = True
expected_path = 'openassessmentblock/message/oa_message_peer.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_self": False,
"waiting": False,
"peer": True,
"peer_not_available": False,
"peer_approaching": False,
"peer_closed": False,
"peer_not_released": False
}
......@@ -425,13 +429,12 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = True
expected_path = 'openassessmentblock/message/oa_message_peer.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_self": False,
"waiting": False,
"peer": True,
"peer_not_available": False,
"peer_approaching": True,
"peer_closed": False,
"peer_not_released": False
}
......@@ -504,13 +507,12 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = False
expected_path = 'openassessmentblock/message/oa_message_peer.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_self": True,
"waiting": True,
"peer": True,
"peer_not_available": True,
"peer_approaching": False,
"peer_closed": False,
"peer_not_released": False
}
......@@ -533,13 +535,12 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = False
expected_path = 'openassessmentblock/message/oa_message_peer.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_self": True,
"waiting": True,
"peer": True,
"peer_not_available": True,
"peer_approaching": True,
"peer_closed": False,
"peer_not_released": False
}
......@@ -587,13 +588,13 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = False
expected_path = 'openassessmentblock/message/oa_message_self.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_peer": True,
"self": True,
"self_approaching": False,
"self_closed": False,
"self_not_released": False
"self_not_released": False,
"peer_not_available": True,
}
self._assert_path_and_context(
......@@ -614,13 +615,13 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = False
expected_path = 'openassessmentblock/message/oa_message_self.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_peer": False,
"self": True,
"self_approaching": False,
"self_closed": False,
"self_not_released": False
"self_not_released": False,
"peer_not_available": True,
}
self._assert_path_and_context(
......@@ -641,13 +642,13 @@ class TestMessageRender(XBlockHandlerTestCase):
has_peers_to_grade = False
expected_path = 'openassessmentblock/message/oa_message_self.html'
expected_path = 'openassessmentblock/message/oa_message_incomplete.html'
expected_context = {
"has_peer": False,
"self": True,
"self_approaching": True,
"self_closed": False,
"self_not_released": False
"self_not_released": False,
"peer_not_available": True,
}
self._assert_path_and_context(
......
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