Reduce score sent via LTI if too late

This commit is contained in:
Sebastian Serth
2020-10-28 11:47:46 +01:00
parent 4cb34a611d
commit 1b5d1d3dca
4 changed files with 28 additions and 17 deletions

View File

@ -155,8 +155,6 @@ module Lti
if provider.nil?
{status: 'error'}
elsif submission.after_late_deadline?
{status: 'too late'}
elsif provider.outcome_service?
Raven.extra_context({
provider: provider.inspect,
@ -165,8 +163,20 @@ module Lti
session: session.to_hash,
exercise_id: submission.exercise_id
})
response = provider.post_replace_result!(submission.normalized_score)
{code: response.response_code, message: response.post_response.body, status: response.code_major}
normalized_lit_score = submission.normalized_score
if submission.before_deadline?
# Keep the full score
elsif submission.within_grace_period?
# Reduce score by 20%
normalized_lit_score *= 0.8
elsif submission.after_late_deadline?
# Reduce score by 100%
normalized_lit_score *= 0.0
else # no deadline
# Keep the full score
end
response = provider.post_replace_result!(normalized_lit_score)
{code: response.response_code, message: response.post_response.body, status: response.code_major, score_sent: normalized_lit_score}
else
{status: 'unsupported'}
end

View File

@ -529,10 +529,11 @@ class ExercisesController < ApplicationController
response = send_score(@submission)
if response[:status] == 'success'
redirect_after_submit
elsif response[:status] == 'too late'
flash[:warning] = I18n.t('exercises.submit.too_late')
flash.keep(:warning)
if response[:score_sent] != @submission.normalized_score
# Score has been reduced due to the passed deadline
flash[:warning] = I18n.t('exercises.submit.too_late')
flash.keep(:warning)
end
redirect_after_submit
else
respond_to do |format|

View File

@ -336,9 +336,9 @@ de:
exercise_deadline_passed: 'Entweder ist die Abgabefrist bereits abgelaufen oder Sie haben die Aufgabe nicht direkt über die E-Learning Plattform gestartet. (Möglicherweise haben Sie den Zurück Button Ihres Browsers benutzt nachdem Sie Ihre Aufgabe abgegeben haben?)'
request_for_comments_sent: "Kommentaranfrage gesendet."
hints:
submission_deadline: Abgaben nach der Abgabefrist werden als verspätet gekennzeichnet.
late_submission_deadline: Abgaben nach der Abgabefrist und vor der verspäteten Abgabefrist werden als verspätet gekennzeichnet und möglicherweise nur mit Punktabzug gewertet. Abgaben nach der verspäteten Abgabefrist werden möglicherweise nicht berücksichtigt.
disclaimer: Bei Fragen zu Deadlines wenden Sie sich bitte an das Teaching Team. Die hier angezeigte Abgabefrist dient nur zur Information und Angaben auf der jeweiligen Kursseite in der E-Learning Platform sollen immer Vorrang haben.
submission_deadline: Abgaben nach der Abgabefrist werden als verspätet gekennzeichnet und die Punktzahl wird nicht an die E-Learning-Plattform übertragen.
late_submission_deadline: Abgaben nach der Abgabefrist und vor der verspäteten Abgabefrist werden als verspätet gekennzeichnet und mit einem 20%-Punktabzug gewertet. Abgaben nach der verspäteten Abgabefrist werden nicht mehr bepunktet.
disclaimer: Bei Fragen zu Deadlines wenden Sie sich bitte an das Teaching Team. Die hier angezeigte Abgabefrist dient nur zur Information und Angaben auf der jeweiligen Kursseite in der E-Learning-Plattform sollen immer Vorrang haben.
editor_file_tree:
file_root: Dateien
import_codeharbor:
@ -375,8 +375,8 @@ de:
no_execution_environment_selected: Bitte eine Ausführungsumgebung auswählen, bevor die Aufgabe aktiviert wird.
none: Keine
hints:
submission_deadline: Ein Zeitpunkt in UTC, zu dem die Abgabe geschlossen wird. Abgaben nach der Abgabefrist werden als verspätet gekennzeichnet.
late_submission_deadline: Eine Gnadenfrist für Abgaben in UTC. Die verlängerte Abgabefrist soll nicht vor der eigentlichen Abgabefrist liegen. Abgaben nach der Abgabefrist werden deutlich gekennzeichnet.
submission_deadline: Ein Zeitpunkt in UTC, zu dem die Abgabe geschlossen wird. Abgaben nach der Abgabefrist werden als verspätet gekennzeichnet und nur mit 20% Punktabzug an die E-Learning-Plattform übertragen.
late_submission_deadline: Eine Gnadenfrist für Abgaben in UTC. Die verlängerte Abgabefrist soll nicht vor der eigentlichen Abgabefrist liegen. Abgaben nach der Abgabefrist werden deutlich gekennzeichnet und mit 100% Punktabzug an die E-Learning-Plattform übertragen.
implement:
alert:
text: 'Ihr Browser unterstützt nicht alle Funktionalitäten, die %{application_name} benötigt. Bitte nutzen Sie einen modernen Browser, um %{application_name} zu besuchen.'

View File

@ -336,8 +336,8 @@ en:
exercise_deadline_passed: 'Either the deadline has already passed or you did not directly access this page from the e-learning platform. (Did you use the Back button of your browser after submitting the score?)'
request_for_comments_sent: "Request for comments sent."
hints:
submission_deadline: Any submission obtained after the deadline will be considered late.
late_submission_deadline: Any submission obtained after the deadline but before the late submission deadline will be considered as late and might only be scored with a penality. Any submission obtained after the late submission deadline might not be considered.
submission_deadline: Any submission obtained after the deadline will be considered late and no score will be sent to the e-learning platform.
late_submission_deadline: Any submission obtained after the deadline but before the late submission deadline will be considered as late and will only be scored with a penality of 20%. Any submission obtained after the late submission deadline will not be scored at all.
disclaimer: If unsure about a deadline, please contact a course instructor. The deadline shown here is only informational and information from the e-learning platform should always take precedence.
editor_file_tree:
file_root: Files
@ -375,8 +375,8 @@ en:
no_execution_environment_selected: Select an execution environment before publishing the exercise.
none: None
hints:
submission_deadline: A date and time in UTC to close the submission. Any submission obtained after the deadline will be considered late.
late_submission_deadline: A grace period for submissions in UTC. The late submission deadline should not be set or any timestamp before the original submission deadline. Any submission obtained after the deadline will be clearly marked.
submission_deadline: A date and time in UTC to close the submission. Any submission obtained after the deadline will be considered late and the score sent to the e-learning platform will be reduced by 20%.
late_submission_deadline: A grace period for submissions in UTC. The late submission deadline should not be set or any timestamp before the original submission deadline. Any submission obtained after the deadline will be clearly marked and the score sent to the e-learning platform will be reduced by 100%.
implement:
alert:
text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.'