Skip to content

Commit

Permalink
Show whether a staff response has been received by a student
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael-Lenander authored and etanttila committed Jun 4, 2024
1 parent f7b360f commit f92a9a8
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 20 deletions.
2 changes: 1 addition & 1 deletion aplus_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def __init__(self, submission_url, **kwargs):

@property
def grading_data(self):
data = self.load_data(self.grading_url)
data = self.load_data(self.grading_url, ignore_cache=True)
data = GraderInterface2(data)
self.__dict__['grading_data'] = data
return data
Expand Down
4 changes: 4 additions & 0 deletions aplus_client/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,7 @@ def submission_time(self):
@none_on_error(KeyError)
def html_url(self):
return self.data.submission.get_item('html_url')

@property
def feedback_response_seen(self):
return self.data.feedback_response_seen
3 changes: 2 additions & 1 deletion feedback/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@ def save(self): # pylint: disable=arguments-differ
instance.response_time = timezone_now()
instance.response_by = user
instance.response_notify = self.get_notify()
instance.response_seen = False

# prepare for upload
upload = async_response_upload(instance) if self.has_changed() else None

# save to db and update form internal state
fields = self._meta.fields + ('response_time', 'response_by', 'response_notify')
fields = self._meta.fields + ('response_time', 'response_by', 'response_notify', 'response_seen')
instance.save(update_fields=fields)
self.original_fields(instance, update=True)

Expand Down
9 changes: 9 additions & 0 deletions feedback/locale/fi/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ msgstr "Arvosana"
msgid "Response notify"
msgstr "Ilmoitus vastauksesta"

#: feedback/models.py
#| msgid "Response time"
msgid "Response seen"
msgstr "Vastaus nähty"

#: feedback/models.py feedback/templates/feedback_tags/contexttag_list.html
msgid "Question key"
msgstr "Kysymyksen avain"
Expand Down Expand Up @@ -406,6 +411,10 @@ msgstr "Päivitä"
msgid "Respond"
msgstr "Vastaa"

#: feedback/templates/manage/_response_message.html
msgid "The student has seen this response."
msgstr "Opiskelija on nähnyt tämän vastauksen."

#: feedback/templates/manage/_response_message.html
msgid "Conflict"
msgstr "Ristiriita"
Expand Down
18 changes: 18 additions & 0 deletions feedback/migrations/0022_feedback_response_seen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.11 on 2024-05-13 18:54

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("feedback", "0021_contexttag"),
]

operations = [
migrations.AddField(
model_name="feedback",
name="response_seen",
field=models.BooleanField(default=False, null=True),
),
]
3 changes: 3 additions & 0 deletions feedback/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ class Meta:
response_notify = models.PositiveSmallIntegerField(default=NOTIFY.NO,
choices=NOTIFY.choices,
verbose_name=_("Response notify"))
response_seen = models.BooleanField(default=False,
null=True,
verbose_name=_("Response seen"))

# response upload
_response_upl_code = models.PositiveSmallIntegerField(default=0,
Expand Down
13 changes: 7 additions & 6 deletions feedback/static/feedback.css
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,14 @@ body.ios .feedback-message tr .glyphicon {
float: right;
margin: 0.2em;
}
.response-message .timestamp {
position: absolute;
bottom: 0;
right: 0;
margin-right: 0.5em;
.response-message .ok-icon {
font-size: 0.8em;
}
.response-message .message-info {
display: flex;
justify-content: flex-end;
align-items: flex-end;
}

.response-msg-bottom {
padding: 0.3em;
display: flex;
Expand Down
37 changes: 25 additions & 12 deletions feedback/templates/manage/_response_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,31 @@
</form>

{% with state=form.has_expired|yesno:"error-conflict,default" %}
<div class="stateful" data-state="{{ state }}">
{% if form.had.responded and form.instance.response_by %}
<span class="timestamp"
{{ state|on_state:"default error-conflict" }}
rel="tooltip"
data-toggle="tooltip"
data-trigger="hover click"
data-placement="bottom"
title="{{ form.instance.response_by.email }}"
> {{ form.instance.response_time|naturaltime }}
</span>
{% endif %}
<div class="stateful message-info" data-state="{{ state }}">
{% if form.had.responded and form.instance.response_by %}
<span>
{% if feedback.response_seen %}
<span
class="glyphicon glyphicon-ok ok-icon"
rel="tooltip"
data-toggle="tooltip"
data-trigger="hover click"
data-placement="bottom"
title="{% trans 'The student has seen this response.' %}"
>
</span>
{% endif %}
<span class="timestamp"
{{ state|on_state:"default error-conflict" }}
rel="tooltip"
data-toggle="tooltip"
data-trigger="hover click"
data-placement="bottom"
title="{{ form.instance.response_by.email }}"
> {{ form.instance.response_time|naturaltime }}
</span>
</span>
{% endif %}
<div class="response-msg-bottom">
<div class="response-label-container">
<span
Expand Down
1 change: 1 addition & 0 deletions feedback/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def form_valid(self, form): # pylint: disable=too-many-locals
'submission_url': self.submission_url or '',
'submission_html_url': gd.html_url,
'timestamp': gd.submission_time,
'response_seen': gd.feedback_response_seen
}

# find if there is submission we should update (aplus resend action for example)
Expand Down

0 comments on commit f92a9a8

Please sign in to comment.