diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index ae11f7c79..a03e4059e 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -469,7 +469,6 @@ var CodeOceanEditor = { }, initializeWorkspaceButtons: function () { - $('#submit').one('click', this.submitCode.bind(this)); $('#assess').one('click', this.scoreCode.bind(this)); $('#render').on('click', this.renderCode.bind(this)); $('#run').on('click', this.runCode.bind(this)); @@ -480,7 +479,6 @@ var CodeOceanEditor = { }, teardownWorkspaceButtons: function () { - $('#submit').unbind('click'); $('#assess').unbind('click'); $('#render').unbind('click'); $('#run').unbind('click'); @@ -859,7 +857,6 @@ var CodeOceanEditor = { showScoringFullScoreMessage: function (url) { $.flash.success({ showPermanent: true, - // TODO: Ask if fa-party-horn from payed version can be used icon: ['fa-solid', 'fa-graduation-cap'], text: I18n.t('exercises.submit.full_score', {url: url}) }); diff --git a/app/assets/javascripts/editor/evaluation.js b/app/assets/javascripts/editor/evaluation.js index d6de84424..50b3e002c 100644 --- a/app/assets/javascripts/editor/evaluation.js +++ b/app/assets/javascripts/editor/evaluation.js @@ -29,28 +29,6 @@ CodeOceanEditorEvaluation = { }, 0).toFixed(2); $('#score').data('score', score); this.renderScore(); - this.showSubmitButton(); - }, - - // TODO: Does this part needs to be changed/removed? - 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 - $('#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"); }, printScoringResult: function (result, index) { diff --git a/app/assets/javascripts/editor/submissions.js b/app/assets/javascripts/editor/submissions.js index e129ef329..179a3a363 100644 --- a/app/assets/javascripts/editor/submissions.js +++ b/app/assets/javascripts/editor/submissions.js @@ -198,29 +198,6 @@ CodeOceanEditorSubmissions = { } }, - // TODO: Should this code be changed/removed? - submitCode: function(event) { - const button = $(event.target) || $('#submit'); - this.startSentryTransaction(button); - this.teardownEventHandlers(); - this.createSubmission(button, null, function (response) { - if (response.redirect) { - this.autosaveIfChanged(); - this.stopCode(event); - this.editors = []; - Turbolinks.clearCache(); - Turbolinks.visit(response.redirect); - } else if (response.status === 'container_depleted') { - this.showContainerDepletedMessage(); - } else if (response.message) { - $.flash.danger({ - text: response.message - }); - } - this.initializeEventHandlers(); - }) - }, - /** * Autosave-Logic */ diff --git a/app/assets/javascripts/exercise_graphs.js b/app/assets/javascripts/exercise_graphs.js index b0aa46f84..d01849fc4 100644 --- a/app/assets/javascripts/exercise_graphs.js +++ b/app/assets/javascripts/exercise_graphs.js @@ -29,11 +29,8 @@ $(document).on('turbolinks:load', function() { maximumValue = submission.score; } - // TODO: Does this part needs to be changed/removed? if(submission.cause == "assess"){ submissionsScoreAndTimeAssess.push(submissionArray); - } else if(submission.cause == "submit"){ - submissionsScoreAndTimeSubmits.push(submissionArray); } else if(submission.cause == "run"){ submissionsScoreAndTimeRuns.push(submissionArray[1]); } else if(submission.cause == "autosave"){ @@ -124,9 +121,6 @@ $(document).on('turbolinks:load', function() { if(largestSubmittedTimeStamp.cause == "assess"){ largestArrayForRange = submissionsScoreAndTimeAssess; x.domain([0,largestArrayForRange[largestArrayForRange.length - 1][1]]).clamp(true); - } else if(largestSubmittedTimeStamp.cause == "submit"){ - largestArrayForRange = submissionsScoreAndTimeSubmits; - x.domain([0,largestArrayForRange[largestArrayForRange.length - 1][1]]).clamp(true); } else if(largestSubmittedTimeStamp.cause == "run"){ largestArrayForRange = submissionsScoreAndTimeRuns; x.domain([0,largestArrayForRange[largestArrayForRange.length - 1]]).clamp(true); diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 361276559..7ee8636e1 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -10,7 +10,7 @@ class ExercisesController < ApplicationController before_action :handle_file_uploads, only: %i[create update] before_action :set_execution_environments, only: %i[index create edit new update] before_action :set_exercise_and_authorize, - only: MEMBER_ACTIONS + %i[clone implement working_times intervention search run statistics submit reload feedback + only: MEMBER_ACTIONS + %i[clone implement working_times intervention search run statistics reload feedback requests_for_comments study_group_dashboard export_external_check export_external_confirm external_user_statistics] before_action :collect_set_and_unset_exercise_tags, only: MEMBER_ACTIONS diff --git a/config/routes.rb b/config/routes.rb index ee83e1aa8..14cfec1dd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -92,8 +92,6 @@ get :statistics get :feedback get :reload - # TODO: Should this route be removed? - post :submit get 'study_group_dashboard/:study_group_id', to: 'exercises#study_group_dashboard' post :export_external_check post :export_external_confirm diff --git a/spec/controllers/exercises_controller_spec.rb b/spec/controllers/exercises_controller_spec.rb index 2c6532109..f02123d9f 100644 --- a/spec/controllers/exercises_controller_spec.rb +++ b/spec/controllers/exercises_controller_spec.rb @@ -288,96 +288,6 @@ end end - describe 'POST #submit' do - let(:output) { {} } - let(:perform_request) { post :submit, format: :json, params: {id: exercise.id, submission: {cause: 'submit', exercise_id: exercise.id}} } - let(:user) { create(:external_user) } - let(:scoring_response) do - [{ - status: :ok, - stdout: '', - stderr: '', - waiting_for_container_time: 0, - container_execution_time: 0, - file_role: 'teacher_defined_test', - count: 1, - failed: 0, - error_messages: [], - passed: 1, - score: 1.0, - filename: 'index.html_spec.rb', - message: 'Well done.', - weight: 2.0, - }] - end - - before do - create(:lti_parameter, external_user: user, exercise:) - submission = build(:submission, exercise:, user:) - allow(submission).to receive(:normalized_score).and_return(1) - allow(submission).to receive(:calculate_score).and_return(scoring_response) - allow(Submission).to receive(:create).and_return(submission) - end - - context 'when LTI outcomes are supported' do - before do - allow(controller).to receive(:lti_outcome_service?).and_return(true) - end - - context 'when the score transmission succeeds' do - before do - allow(controller).to receive(:send_score).and_return(status: 'success') - perform_request - end - - expect_assigns(exercise: :exercise) - - it 'creates a submission' do - expect(assigns(:submission)).to be_a(Submission) - end - - expect_json - expect_http_status(:ok) - end - - context 'when the score transmission fails' do - before do - allow(controller).to receive(:send_score).and_return(status: 'unsupported') - perform_request - end - - expect_assigns(exercise: :exercise) - - it 'creates a submission' do - expect(assigns(:submission)).to be_a(Submission) - end - - expect_json - expect_http_status(:service_unavailable) - end - end - - context 'when LTI outcomes are not supported' do - before do - allow(controller).to receive(:lti_outcome_service?).and_return(false) - perform_request - end - - expect_assigns(exercise: :exercise) - - it 'creates a submission' do - expect(assigns(:submission)).to be_a(Submission) - end - - it 'does not send scores' do - expect(controller).not_to receive(:send_score) - end - - expect_json - expect_http_status(:ok) - end - end - describe 'PUT #update' do context 'with a valid exercise' do let(:exercise_attributes) { build(:dummy).attributes }