diff --git a/numbas_lti/forms.py b/numbas_lti/forms.py index 885efd41..fd6e5b56 100644 --- a/numbas_lti/forms.py +++ b/numbas_lti/forms.py @@ -205,6 +205,7 @@ def save(self, commit=True): class CreateExamForm(ModelForm): package = forms.FileField(required=False) + class Meta: model = Exam fields = ['package','retrieve_url','rest_url'] diff --git a/numbas_lti/models.py b/numbas_lti/models.py index 072721cd..0ad9adbf 100644 --- a/numbas_lti/models.py +++ b/numbas_lti/models.py @@ -285,6 +285,34 @@ def duration(self): return self._duration + def get_feedback_settings(self, completed, review_allowed): + content = self.source() + + def get(node, attr, default=None): + return node.get(attr, node.get(attr.lower(), default)) + + feedback = get(content, 'feedback', {}) + + def resolve_feedback_setting(setting): + return { + 'always': True, + 'oncompletion': completed, + 'inreview': review_allowed, + 'never': False, + }[setting] + + info = [ + (_('Maximum available score'), get(feedback,'showTotalMark', 'always')), + (_('Whether answers are correct'), get(feedback,'showAnswerState', 'always')), + (_('Awarded scores'), get(feedback,'showActualMark', 'always')), + (_('Feedback messages for each question part'), get(feedback, 'showPartFeedbackMessages', 'always')), + (_('Expected answers to each part'), get(feedback, 'revealExpectedAnswers', 'inreview')), + (_('Advice for each question'), get(feedback, 'revealAdvice', 'inreview')), + ] + + return info + + GRADING_METHODS = [ ('highest',_('Highest score')), ('last',_('Last attempt')), diff --git a/numbas_lti/templates/numbas_lti/review_not_allowed.html b/numbas_lti/templates/numbas_lti/review_not_allowed.html deleted file mode 100644 index 1178cc46..00000000 --- a/numbas_lti/templates/numbas_lti/review_not_allowed.html +++ /dev/null @@ -1 +0,0 @@ -{% load i18n %}{% blocktranslate with time_iso=allow_review_from|date:"c" time=allow_review_from %}Review will be available from .{% endblocktranslate %} diff --git a/numbas_lti/templates/numbas_lti/show_attempts.html b/numbas_lti/templates/numbas_lti/show_attempts.html index 65d9dafe..559e6733 100644 --- a/numbas_lti/templates/numbas_lti/show_attempts.html +++ b/numbas_lti/templates/numbas_lti/show_attempts.html @@ -71,15 +71,9 @@
{% blocktranslate with time_iso=resource.allow_review_from|date:"c" time=resource.allow_review_from %}Full review will be available from .{% endblocktranslate %}
+ {% endif %} + +{% blocktranslate %}These are the feedback settings for this activity:{% endblocktranslate %}
+ +{% translate "Feedback" %} | +{% translate "Available from" %} | +
---|---|
{{label}} | ++ {% if when == 'always' %}{% translate "The start of the attempt" %}{% endif %} + {% if when == 'oncompletion' %}{% translate "Immediately after finishing" %}{% endif %} + {% if when == 'inreview' %}{% translate "When full review is allowed" %}{% endif %} + {% if when == 'never' %}{% translate "Never" %}{% endif %} + | +