From 50b81df74223e73b7b0aa912ec46c35401f09fc8 Mon Sep 17 00:00:00 2001 From: Karol Date: Tue, 23 Aug 2022 21:12:03 +0200 Subject: [PATCH] proforma upgrade and small fixes --- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- app/controllers/codeharbor_links_controller.rb | 2 +- app/services/exercise_service/check_external.rb | 4 ++-- .../proforma_service/convert_exercise_to_task.rb | 2 +- app/views/exercises/_export_actions.html.slim | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index 79c41778..571e9bdd 100644 --- a/Gemfile +++ b/Gemfile @@ -28,7 +28,7 @@ gem 'net-smtp', require: false gem 'nokogiri' gem 'pagedown-bootstrap-rails' gem 'pg' -gem 'proforma', github: 'openHPI/proforma', branch: 'v0.5.2' +gem 'proforma', github: 'openHPI/proforma', tag: 'v0.7.1' gem 'prometheus_exporter' gem 'pry-byebug' gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index 8354d194..d24c77ff 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,13 +1,13 @@ GIT remote: https://github.com/openHPI/proforma.git - revision: 243853e66034bc2afbb9c9661475d9718d007304 - branch: v0.5.2 + revision: cf61517a5cd765afb9d0d19ea1c692e18e3131d7 + tag: v0.7.1 specs: - proforma (0.5.2) - activemodel (>= 5.2.3, < 7.2.0) - activesupport (>= 5.2.3, < 7.2.0) - nokogiri (~> 1.13) - rubyzip (~> 2.3) + proforma (0.7.1) + activemodel (>= 5.2.3, < 8.0.0) + activesupport (>= 5.2.3, < 8.0.0) + nokogiri (>= 1.10.2, < 2.0.0) + rubyzip (>= 1.2.2, < 3.0.0) GEM remote: https://rubygems.org/ diff --git a/app/controllers/codeharbor_links_controller.rb b/app/controllers/codeharbor_links_controller.rb index c98b02b1..0daeb4ea 100644 --- a/app/controllers/codeharbor_links_controller.rb +++ b/app/controllers/codeharbor_links_controller.rb @@ -7,7 +7,7 @@ class CodeharborLinksController < ApplicationController def new base_url = CodeOcean::Config.new(:code_ocean).read[:codeharbor][:url] || '' - @codeharbor_link = CodeharborLink.new(push_url: "#{base_url}/import_exercise", + @codeharbor_link = CodeharborLink.new(push_url: "#{base_url}/import_task", check_uuid_url: "#{base_url}/import_uuid_check") authorize! end diff --git a/app/services/exercise_service/check_external.rb b/app/services/exercise_service/check_external.rb index ab7f0db9..04392d4c 100644 --- a/app/services/exercise_service/check_external.rb +++ b/app/services/exercise_service/check_external.rb @@ -14,9 +14,9 @@ module ExerciseService req.headers['Authorization'] = "Bearer #{@codeharbor_link.api_key}" req.body = {uuid: @uuid}.to_json end - response_hash = JSON.parse(response.body, symbolize_names: true).slice(:task_found, :update_right) + response_hash = JSON.parse(response.body, symbolize_names: true).slice(:uuid_found, :update_right) - {error: false, message: message(response_hash[:task_found], response_hash[:update_right])}.merge(response_hash) + {error: false, message: message(response_hash[:uuid_found], response_hash[:update_right])}.merge(response_hash) rescue Faraday::Error, JSON::ParserError {error: true, message: I18n.t('exercises.export_codeharbor.error')} end diff --git a/app/services/proforma_service/convert_exercise_to_task.rb b/app/services/proforma_service/convert_exercise_to_task.rb index 9a8d7f67..7df4becd 100644 --- a/app/services/proforma_service/convert_exercise_to_task.rb +++ b/app/services/proforma_service/convert_exercise_to_task.rb @@ -109,7 +109,7 @@ module ProformaService filename: filename(file), usage_by_lms: file.read_only ? 'display' : 'edit', visible: file.hidden ? 'no' : 'yes', - internal_description: file.role || 'regular_file' + # internal_description: file.role || 'regular_file' ) add_content_to_task_file(file, task_file) task_file diff --git a/app/views/exercises/_export_actions.html.slim b/app/views/exercises/_export_actions.html.slim index f2d0a2f7..72029aee 100644 --- a/app/views/exercises/_export_actions.html.slim +++ b/app/views/exercises/_export_actions.html.slim @@ -1,7 +1,7 @@ - if error - = button_tag type: 'button', class:'btn btn-primary float-end export-button export-retry-button', data: {exercise_id: exercise.id} do - i.fa-solid.fa-arrows-rotate.confirm-icon - = t('exercises.export_codeharbor.buttons.retry') + = button_tag type: 'button', class:'btn btn-primary float-end export-button export-retry-button', data: {exercise_id: exercise.id} do + i.fa-solid.fa-arrows-rotate.confirm-icon + = t('exercises.export_codeharbor.buttons.retry') - else - unless exported - if !task_found || update_right @@ -9,6 +9,6 @@ i.fa-solid.fa-check.confirm-icon = t('exercises.export_codeharbor.buttons.export') -= button_tag type: 'submit', class:'btn btn-secondary float-end export-button', data: {dismiss: 'modal'} do += button_tag type: 'submit', class:'btn btn-secondary float-end export-button', data: {bs_dismiss: 'modal'} do i.fa-solid.fa-xmark.abort-icon = exported ? t('exercises.export_codeharbor.buttons.close') : t('exercises.export_codeharbor.buttons.abort')