From 01f4f0c2cd7896f02dd05b12763240d3862816d8 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Fri, 28 Jul 2023 08:50:00 +0200 Subject: [PATCH] Remove legacy CodePilot integration --- app/assets/javascripts/editor.js | 1 - app/assets/javascripts/editor/editor.js.erb | 7 ------ app/assets/javascripts/editor/evaluation.js | 7 ------ .../editor/participantsupport.js.erb | 25 ------------------- app/controllers/exercises_controller.rb | 6 ----- app/helpers/exercise_helper.rb | 10 -------- app/views/exercises/implement.html.slim | 9 +------ config/code_ocean.yml.ci | 2 -- config/code_ocean.yml.example | 8 ------ 9 files changed, 1 insertion(+), 74 deletions(-) diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index 6dc79b7f..028ac69f 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -10,7 +10,6 @@ $(document).on('turbolinks:load', function(event) { CodeOceanEditorTurtle, CodeOceanEditorWebsocket, CodeOceanEditorPrompt, - CodeOceanEditorCodePilot, CodeOceanEditorRequestForComments ); diff --git a/app/assets/javascripts/editor/editor.js.erb b/app/assets/javascripts/editor/editor.js.erb index 6c6420ae..401db40f 100644 --- a/app/assets/javascripts/editor/editor.js.erb +++ b/app/assets/javascripts/editor/editor.js.erb @@ -281,12 +281,6 @@ var CodeOceanEditor = { var editor = ace.edit(element); - if (this.qa_api) { - editor.getSession().on("change", function (deltaObject) { - this.qa_api.executeCommand('syncEditor', [this.active_file, deltaObject]); - }.bind(this)); - } - var document = editor.getSession().getDocument(); // insert pre-existing code into editor. we have to use insertLines, otherwise the deltas are not properly added var file_id = $(element).data('file-id'); @@ -1013,7 +1007,6 @@ var CodeOceanEditor = { initializeEverything: function () { CodeOceanEditor.editors = []; this.initializeRegexes(); - this.initializeCodePilot(); this.configureEditors(); this.initializeEditors(); this.initializeEventHandlers(); diff --git a/app/assets/javascripts/editor/evaluation.js b/app/assets/javascripts/editor/evaluation.js index 42930fb5..f4c8c41a 100644 --- a/app/assets/javascripts/editor/evaluation.js +++ b/app/assets/javascripts/editor/evaluation.js @@ -114,10 +114,6 @@ CodeOceanEditorEvaluation = { })) { this.showContainerDepletedMessage(); } - if (this.qa_api) { - // send test response to QA - this.qa_api.executeCommand('syncOutput', [response]); - } }, renderScore: function () { @@ -138,9 +134,6 @@ CodeOceanEditorEvaluation = { handleTestResponse: function (result) { this.clearOutput(); this.printOutput(result, false, 0); - if (this.qa_api) { - this.qa_api.executeCommand('syncOutput', [result]); - } this.showStatus(result); this.showOutputBar(); }, diff --git a/app/assets/javascripts/editor/participantsupport.js.erb b/app/assets/javascripts/editor/participantsupport.js.erb index c46bd5d9..a95dbb40 100644 --- a/app/assets/javascripts/editor/participantsupport.js.erb +++ b/app/assets/javascripts/editor/participantsupport.js.erb @@ -107,31 +107,6 @@ CodeOceanEditorFlowr = { } }; -CodeOceanEditorCodePilot = { - qa_api: undefined, - QaApiOutputBuffer: {'stdout': '', 'stderr': ''}, - - initializeCodePilot: function () { - if ($('#questions-column').isPresent() && (typeof QaApi != 'undefined')) { - $('#editor-column').addClass('col-md-10').removeClass('col-md-12'); - $('#questions-column').addClass('col-md-2'); - - var node = document.getElementById('questions-holder'); - var url = $('#questions-holder').data('url'); - - this.qa_api = new QaApi(node, url); - } - }, - - handleQaApiOutput: function () { - if (this.qa_api) { - this.qa_api.executeCommand('syncOutput', [[this.QaApiOutputBuffer]]); - // reset the object - } - this.QaApiOutputBuffer = {'stdout': '', 'stderr': ''}; - } -}; - CodeOceanEditorRequestForComments = { requestComments: function () { const cause = $('#requestComments'); diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 7e807103..65447fab 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -335,12 +335,6 @@ class ExercisesController < ApplicationController @submission = current_user.submissions.where(exercise_id: @exercise.id).order('created_at DESC').first @files = (@submission ? @submission.collect_files : @exercise.files).select(&:visible).sort_by(&:filepath) @paths = collect_paths(@files) - - @user_id = if current_user.respond_to? :external_id - current_user.external_id - else - current_user.id - end end def set_available_tips diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index da8153c2..87d40737 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -3,17 +3,7 @@ module ExerciseHelper include LtiHelper - CODEPILOT_CONFIG = CodeOcean::Config.new(:code_ocean).read[:code_pilot] - def embedding_parameters(exercise) "locale=#{I18n.locale}&token=#{exercise.token}" end - - def qa_js_tag - javascript_include_tag "#{qa_url}/assets/qa_api.js", integrity: true, crossorigin: 'anonymous' - end - - def qa_url - CODEPILOT_CONFIG[:url] if CODEPILOT_CONFIG[:enabled] - end end diff --git a/app/views/exercises/implement.html.slim b/app/views/exercises/implement.html.slim index cd455ed4..39a11785 100644 --- a/app/views/exercises/implement.html.slim +++ b/app/views/exercises/implement.html.slim @@ -3,8 +3,7 @@ Otherwise, lti_parameters might be nil meta name="turbolinks-cache-control" content="no-cache" -// col-md-12 required for CodePilot -#editor-column.col-md-12 +#editor-column - unless @embed_options[:hide_exercise_description] .exercise.clearfix div @@ -25,9 +24,3 @@ = render('editor', exercise: @exercise, files: @files, submission: @submission) - -- if qa_url - #questions-column - #questions-holder data-url="#{qa_url}/qa/index/#{@exercise.id}/#{@user_id}" - = qa_js_tag - diff --git a/config/code_ocean.yml.ci b/config/code_ocean.yml.ci index 92b4eb01..e5a01d79 100644 --- a/config/code_ocean.yml.ci +++ b/config/code_ocean.yml.ci @@ -1,8 +1,6 @@ test: flowr: enabled: false - code_pilot: - enabled: false codeharbor: enabled: false codeocean_events: diff --git a/config/code_ocean.yml.example b/config/code_ocean.yml.example index d7ba03ac..3da08cec 100644 --- a/config/code_ocean.yml.example +++ b/config/code_ocean.yml.example @@ -16,14 +16,6 @@ default: &default # The number of search results to be displayed answers_per_query: 3 - code_pilot: - # When enabled, CodePilot can be used by learners to request individual help by a tutor - # through a video conferencing system. Optionally, it also provides access to recordings - # of previous sessions. Support for CodePilot is currently in beta. - enabled: false - # The root URL of CodePilot - url: //localhost:3000 - codeharbor: # When enabled, CodeHarbor is integrated in the teachers' view and allows importing # and exporting exercises from CodeOcean using the ProFormA XML format to CodeHarbor.