add more CO specific data to metadata

This commit is contained in:
Karol
2022-08-24 00:19:53 +02:00
parent 50b81df742
commit 76c9dfa4e5
2 changed files with 15 additions and 5 deletions

View File

@ -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

View File

@ -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