diff --git a/app/services/proforma_service/convert_exercise_to_task.rb b/app/services/proforma_service/convert_exercise_to_task.rb index 7df4becd..a60cdbf8 100644 --- a/app/services/proforma_service/convert_exercise_to_task.rb +++ b/app/services/proforma_service/convert_exercise_to_task.rb @@ -23,7 +23,6 @@ module ProformaService title: @exercise.title, description: @exercise.description, internal_description: nil, - # ?: @exercise.instructions, store in meta-data # proglang: proglang, where can we get this information? files: task_files, tests: tests, @@ -32,7 +31,12 @@ module ProformaService model_solutions: model_solutions, meta_data: { CodeOcean: { - instructions: @exercise.instructions, + public: @exercise.public, + hide_file_tree: @exercise.hide_file_tree, + allow_file_creation: @exercise.allow_file_creation, + allow_auto_completion: @exercise.allow_auto_completion, + expected_difficulty: @exercise.expected_difficulty, + execution_environment_id: @exercise.execution_environment_id, }, }, }.compact @@ -78,8 +82,8 @@ module ProformaService def test_meta_data(file) { CodeOcean: { - 'entry-point': file.filepath, 'feedback-message': file.feedback_message, + weight: file.weight, }, } end diff --git a/app/services/proforma_service/convert_task_to_exercise.rb b/app/services/proforma_service/convert_task_to_exercise.rb index 35e62180..bf027e00 100644 --- a/app/services/proforma_service/convert_task_to_exercise.rb +++ b/app/services/proforma_service/convert_task_to_exercise.rb @@ -21,7 +21,13 @@ module ProformaService user: @user, title: @task.title, description: @task.description, - instructions: @task.meta_data&.dig(:CodeOcean)&.dig(:instructions), + public: @task.meta_data[:CodeOcean]&.dig(:public) == 'true', + hide_file_tree: @task.meta_data[:CodeOcean]&.dig(:hide_file_tree) == 'true', + allow_file_creation: @task.meta_data[:CodeOcean]&.dig(:allow_file_creation) == 'true', + allow_auto_completion: @task.meta_data[:CodeOcean]&.dig(:allow_auto_completion) == 'true', + expected_difficulty: @task.meta_data[:CodeOcean]&.dig(:expected_difficulty), + execution_environment_id: @task.meta_data[:CodeOcean]&.dig(:execution_environment_id), + files: files ) end @@ -33,7 +39,7 @@ module ProformaService def test_files @task.tests.map do |test_object| task_files.delete(test_object.files.first.id).tap do |file| - file.weight = 1.0 + file.weight = test_object.meta_data[:CodeOcean]&.dig(:weight) || 1.0 file.feedback_message = test_object.meta_data[:CodeOcean]&.dig(:'feedback-message').presence || 'Feedback' file.role = 'teacher_defined_test' end