Add deadline information to submission page and some minor bugfixes
This commit is contained in:
@ -793,6 +793,7 @@ var CodeOceanEditor = {
|
||||
this.renderScore();
|
||||
this.showFirstFile();
|
||||
this.resizeAceEditors();
|
||||
this.initializeDeadlines();
|
||||
|
||||
window.addEventListener("beforeunload", this.unloadAutoSave.bind(this));
|
||||
window.addEventListener("page:before-change", this.unloadAutoSave.bind(this));
|
||||
|
@ -23,6 +23,27 @@ CodeOceanEditorEvaluation = {
|
||||
}, 0).toFixed(2);
|
||||
$('#score').data('score', score);
|
||||
this.renderScore();
|
||||
this.showSubmitButton();
|
||||
},
|
||||
|
||||
showSubmitButton: function () {
|
||||
if (this.submission_deadline || this.late_submission_deadline) {
|
||||
const now = new Date();
|
||||
if (now <= this.submission_deadline) {
|
||||
// before_deadline
|
||||
// default is btn-success, so no change in color
|
||||
$('#submit').get(0).lastChild.nodeValue = I18n.t('exercises.editor.submit_on_time');
|
||||
} else if (now > this.submission_deadline && this.late_submission_deadline && now <= this.late_submission_deadline) {
|
||||
// within_grace_period
|
||||
$('#submit').removeClass("btn-success btn-warning").addClass("btn-warning");
|
||||
$('#submit').get(0).lastChild.nodeValue = I18n.t('exercises.editor.submit_within_grace_period');
|
||||
} else if (this.late_submission_deadline && now > this.late_submission_deadline || now > this.submission_deadline) {
|
||||
// after_late_deadline
|
||||
debugger;
|
||||
$('#submit').removeClass("btn-success btn-warning btn-danger").addClass("btn-danger");
|
||||
$('#submit').get(0).lastChild.nodeValue = I18n.t('exercises.editor.submit_after_late_deadline');
|
||||
}
|
||||
}
|
||||
$('#submit').removeClass("d-none");
|
||||
},
|
||||
|
||||
@ -66,10 +87,9 @@ CodeOceanEditorEvaluation = {
|
||||
var score = parseFloat($('#score').data('score'));
|
||||
var maximum_score = parseFloat($('#score').data('maximum-score'));
|
||||
if (score >= 0 && score <= maximum_score && maximum_score > 0) {
|
||||
var percentage_score = (score / maximum_score * 100 ).toFixed(0);
|
||||
var percentage_score = (score / maximum_score * 100).toFixed(0);
|
||||
$('.score').html(percentage_score + '%');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$('.score').html(0 + '%');
|
||||
}
|
||||
this.renderProgressBar(score, maximum_score);
|
||||
@ -110,7 +130,7 @@ CodeOceanEditorEvaluation = {
|
||||
this.running = false;
|
||||
},
|
||||
|
||||
cleanUpUI: function() {
|
||||
cleanUpUI: function () {
|
||||
this.hideSpinner();
|
||||
this.toggleButtonStates();
|
||||
this.hidePrompt();
|
||||
@ -119,12 +139,12 @@ CodeOceanEditorEvaluation = {
|
||||
/**
|
||||
* Output-Logic
|
||||
*/
|
||||
renderWebsocketOutput: function(msg){
|
||||
renderWebsocketOutput: function (msg) {
|
||||
var element = this.findOrCreateRenderElement(0);
|
||||
element.append(msg.data);
|
||||
},
|
||||
|
||||
printWebsocketOutput: function(msg) {
|
||||
printWebsocketOutput: function (msg) {
|
||||
if (!msg.data) {
|
||||
return;
|
||||
}
|
||||
@ -134,12 +154,12 @@ CodeOceanEditorEvaluation = {
|
||||
this.printOutput(stream, true, 0);
|
||||
},
|
||||
|
||||
clearOutput: function() {
|
||||
clearOutput: function () {
|
||||
$('#output pre').remove();
|
||||
CodeOceanEditorTurtle.hideCanvas();
|
||||
},
|
||||
|
||||
clearScoringOutput: function() {
|
||||
clearScoringOutput: function () {
|
||||
$('#results ul').first().html('');
|
||||
$('.test-count .number').html(0);
|
||||
$('#score').data('score', 0);
|
||||
@ -177,7 +197,38 @@ CodeOceanEditorEvaluation = {
|
||||
} else {
|
||||
element.addClass('text-muted').text($('#output').data('message-no-output'));
|
||||
}
|
||||
},
|
||||
|
||||
initializeDeadlines: function () {
|
||||
const deadline = $('#deadline');
|
||||
if (deadline) {
|
||||
const submission_deadline = deadline.data('submission-deadline');
|
||||
const late_submission_deadline = deadline.data('late-submission-deadline');
|
||||
|
||||
const ul = document.createElement("ul");
|
||||
|
||||
if (submission_deadline) {
|
||||
this.submission_deadline = new Date(submission_deadline);
|
||||
const date = `<b>${I18n.l("time.formats.long", this.submission_deadline)}</b>: ${I18n.t('activerecord.attributes.exercise.submission_deadline')}`;
|
||||
const bullet_point = `${date}<br/><small>${I18n.t('exercises.editor.hints.submission_deadline')}</small>`;
|
||||
|
||||
let li = document.createElement("li");
|
||||
let text = $.parseHTML(bullet_point);
|
||||
$(li).append(text);
|
||||
ul.append(li);
|
||||
}
|
||||
|
||||
if (late_submission_deadline) {
|
||||
this.late_submission_deadline = new Date(late_submission_deadline);
|
||||
const date = `<b>${I18n.l("time.formats.long", this.late_submission_deadline)}</b>: ${I18n.t('activerecord.attributes.exercise.late_submission_deadline')}`;
|
||||
const bullet_point = `${date}<br/><small>${I18n.t('exercises.editor.hints.late_submission_deadline')}</small>`;
|
||||
|
||||
let li = document.createElement("li");
|
||||
let text = $.parseHTML(bullet_point);
|
||||
$(li).append(text);
|
||||
ul.append(li);
|
||||
}
|
||||
$(ul).insertAfter($(deadline).children()[0]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -420,9 +420,10 @@ class ExercisesController < ApplicationController
|
||||
else
|
||||
final_submissions = Submission.where(user: @external_user, exercise_id: @exercise.id).in_study_group_of(current_user).final
|
||||
@submissions = []
|
||||
@submissions.push final_submissions.before_deadline.latest
|
||||
@submissions.push final_submissions.within_grace_period.latest
|
||||
@submissions.push final_submissions.after_late_deadline.latest
|
||||
%i[before_deadline within_grace_period after_late_deadline].each do |filter|
|
||||
relevant_submission = final_submissions.send(filter).latest
|
||||
@submissions.push relevant_submission if relevant_submission.present?
|
||||
end
|
||||
@all_events = @submissions
|
||||
end
|
||||
render 'exercises/external_users/statistics'
|
||||
|
@ -32,6 +32,10 @@ div.h-100 id='output_sidebar_uncollapsed' class='d-none col-sm-12 enforce-bottom
|
||||
br
|
||||
- if lti_outcome_service?(@exercise.id, external_user_id, consumer_id)
|
||||
p.text-center = render('editor_button', classes: 'btn-lg btn-success d-none', data: {:'data-url' => submit_exercise_path(@exercise)}, icon: 'fa fa-send', id: 'submit', label: t('exercises.editor.submit'))
|
||||
- if @exercise.submission_deadline.present? || @exercise.late_submission_deadline.present?
|
||||
#deadline data-submission-deadline=@exercise.submission_deadline&.rfc2822 data-late-submission-deadline=@exercise.late_submission_deadline&.rfc2822
|
||||
h4 = t('exercises.editor.deadline')
|
||||
= t('exercises.editor.hints.disclaimer')
|
||||
- else
|
||||
p.text-center = render('editor_button', classes: 'btn-lg btn-secondary disabled', data: {:'data-placement' => 'bottom', :'data-tooltip' => true}, icon: 'fa fa-clock-o', id: 'submit_outdated', label: t('exercises.editor.exercise_deadline_passed'), title: t('exercises.editor.tooltips.exercise_deadline_passed'))
|
||||
hr
|
||||
|
@ -311,6 +311,10 @@ de:
|
||||
start_over_active_file: Diese Datei zurücksetzen
|
||||
stop: Stoppen
|
||||
submit: Code zur Bewertung abgeben
|
||||
deadline: Abgabefrist
|
||||
submit_on_time: Code rechtzeitig zur Bewertung abgeben
|
||||
submit_within_grace_period: Code innerhalb der Gnadenfrist zur Bewertung abgeben
|
||||
submit_after_late_deadline: Code verspätet zur Bewertung abgeben
|
||||
test: Testen
|
||||
timeout: 'Ausführung gestoppt. Ihr Code hat die erlaubte Ausführungszeit von %{permitted_execution_time} Sekunden überschritten.'
|
||||
exercise_deadline_passed: 'Das Ergebnis kann nicht übertragen werden.'
|
||||
@ -318,6 +322,10 @@ de:
|
||||
save: Ihr Code wird automatisch gespeichert, wann immer Sie eine Datei herunterladen, ausführen oder testen. Explizites Speichern ist also selten notwendig.
|
||||
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: Einreichungen 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 der Abgabefrist wenden Sie sich bitte an einen Kursleiter. Die hier angezeigte Abgabefrist dient nur zur Information und Informationen aus der E-Learning Platform sollten immer Vorrang haben.
|
||||
editor_file_tree:
|
||||
file_root: Dateien
|
||||
import_codeharbor:
|
||||
@ -352,8 +360,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. Einreichungen 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. Nachdem die Gnadenfrist verstichen ist, werden keine neuen Einreichungen mehr akzeptiert.
|
||||
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.
|
||||
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.'
|
||||
|
@ -311,6 +311,10 @@ en:
|
||||
start_over_active_file: Reset this file
|
||||
stop: Stop
|
||||
submit: Submit Code For Assessment
|
||||
deadline: Deadline
|
||||
submit_on_time: Submit Code for Assessment on Time
|
||||
submit_within_grace_period: Submit Code for Assessment Within Grace Period
|
||||
submit_after_late_deadline: Submit Code for Assessment After Deadline Passed
|
||||
test: Test
|
||||
timeout: 'Execution stopped. Your code exceeded the permitted execution time of %{permitted_execution_time} seconds.'
|
||||
exercise_deadline_passed: 'The score cannot be submitted.'
|
||||
@ -318,6 +322,10 @@ en:
|
||||
save: Your code is automatically saved whenever you download, run, or test it. Therefore, explicitly saving is rarely necessary.
|
||||
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.
|
||||
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
|
||||
import_codeharbor:
|
||||
@ -353,7 +361,7 @@ en:
|
||||
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. After the late submission deadline passed, any new submissions are prevented.
|
||||
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.
|
||||
implement:
|
||||
alert:
|
||||
text: 'Your browser does not support features required for using %{application_name}. Please access %{application_name} using a modern browser.'
|
||||
|
Reference in New Issue
Block a user