change namespace to CodeOcean

This commit is contained in:
Karol
2021-12-06 20:23:30 +01:00
parent 2c7748ed12
commit ec49f91a08
6 changed files with 18 additions and 16 deletions

View File

@ -31,7 +31,7 @@ module ProformaService
language: DEFAULT_LANGUAGE, language: DEFAULT_LANGUAGE,
model_solutions: model_solutions, model_solutions: model_solutions,
meta_data: { meta_data: {
openHPI: { CodeOcean: {
instructions: @exercise.instructions, instructions: @exercise.instructions,
}, },
}, },
@ -76,10 +76,12 @@ module ProformaService
end end
def test_meta_data(file) def test_meta_data(file)
{openHPI: { {
'entry-point': file.filepath, CodeOcean: {
'feedback-message': file.feedback_message, 'entry-point': file.filepath,
}} 'feedback-message': file.feedback_message,
},
}
end end
def test_file(file) def test_file(file)

View File

@ -21,7 +21,7 @@ module ProformaService
user: @user, user: @user,
title: @task.title, title: @task.title,
description: @task.description, description: @task.description,
instructions: @task.meta_data&.dig(:openHPI)&.dig(:instructions), instructions: @task.meta_data&.dig(:CodeOcean)&.dig(:instructions),
files: files files: files
) )
end end
@ -34,7 +34,7 @@ module ProformaService
@task.tests.map do |test_object| @task.tests.map do |test_object|
task_files.delete(test_object.files.first.id).tap do |file| task_files.delete(test_object.files.first.id).tap do |file|
file.weight = 1.0 file.weight = 1.0
file.feedback_message = test_object.meta_data[:openHPI]&.dig(:'feedback-message') file.feedback_message = test_object.meta_data[:CodeOcean]&.dig(:'feedback-message')
end end
end end
end end

View File

@ -9,7 +9,7 @@ module ProformaService
def execute def execute
@task = ConvertExerciseToTask.call(exercise: @exercise) @task = ConvertExerciseToTask.call(exercise: @exercise)
namespaces = [{prefix: 'openHPI', uri: 'open.hpi.de'}] namespaces = [{prefix: 'CodeOcean', uri: 'codeocean.openhpi.de'}]
exporter = Proforma::Exporter.new(task: @task, custom_namespaces: namespaces) exporter = Proforma::Exporter.new(task: @task, custom_namespaces: namespaces)
exporter.perform exporter.perform
end end

View File

@ -38,7 +38,7 @@ RSpec.describe ProformaService::ConvertExerciseToTask do
uuid: exercise.uuid, uuid: exercise.uuid,
language: described_class::DEFAULT_LANGUAGE, language: described_class::DEFAULT_LANGUAGE,
meta_data: { meta_data: {
openHPI: { CodeOcean: {
instructions: exercise.instructions, instructions: exercise.instructions,
}, },
}, },
@ -167,7 +167,7 @@ RSpec.describe ProformaService::ConvertExerciseToTask do
title: test_file.name, title: test_file.name,
files: have(1).item, files: have(1).item,
meta_data: { meta_data: {
openHPI: { CodeOcean: {
'entry-point': test_file.filepath, 'entry-point': test_file.filepath,
'feedback-message': 'feedback_message', 'feedback-message': 'feedback_message',
}, },

View File

@ -39,7 +39,7 @@ describe ProformaService::ConvertTaskToExercise do
parent_uuid: 'parent_uuid', parent_uuid: 'parent_uuid',
language: 'language', language: 'language',
meta_data: { meta_data: {
openHPI: { CodeOcean: {
instructions: 'instructions', instructions: 'instructions',
}, },
}, },
@ -233,7 +233,7 @@ describe ProformaService::ConvertTaskToExercise do
test_type: 'test_type', test_type: 'test_type',
files: test_files, files: test_files,
meta_data: { meta_data: {
openHPI: { CodeOcean: {
'feedback-message': 'feedback-message', 'feedback-message': 'feedback-message',
'testing-framework': 'testing-framework', 'testing-framework': 'testing-framework',
'testing-framework-version': 'testing-framework-version', 'testing-framework-version': 'testing-framework-version',
@ -278,7 +278,7 @@ describe ProformaService::ConvertTaskToExercise do
Proforma::Test.new( Proforma::Test.new(
files: test_files2, files: test_files2,
meta_data: { meta_data: {
openHPI: { CodeOcean: {
'feedback-message': 'feedback-message', 'feedback-message': 'feedback-message',
'testing-framework': 'testing-framework', 'testing-framework': 'testing-framework',
'testing-framework-version': 'testing-framework-version', 'testing-framework-version': 'testing-framework-version',
@ -324,7 +324,7 @@ describe ProformaService::ConvertTaskToExercise do
id: exercise.id, id: exercise.id,
title: task.title, title: task.title,
description: task.description, description: task.description,
instructions: task.meta_data[:openHPI][:instructions], instructions: task.meta_data[:CodeOcean][:instructions],
execution_environment: exercise.execution_environment, execution_environment: exercise.execution_environment,
uuid: exercise.uuid, uuid: exercise.uuid,
user: exercise.user, user: exercise.user,
@ -360,7 +360,7 @@ describe ProformaService::ConvertTaskToExercise do
test_type: 'test_type', test_type: 'test_type',
files: test_files, files: test_files,
meta_data: { meta_data: {
openHPI: { CodeOcean: {
'feedback-message': 'feedback-message', 'feedback-message': 'feedback-message',
'testing-framework': 'testing-framework', 'testing-framework': 'testing-framework',
'testing-framework-version': 'testing-framework-version', 'testing-framework-version': 'testing-framework-version',

View File

@ -30,7 +30,7 @@ describe ProformaService::ExportTask do
before do before do
allow(ProformaService::ConvertExerciseToTask).to receive(:call).with(exercise: exercise).and_return(task) allow(ProformaService::ConvertExerciseToTask).to receive(:call).with(exercise: exercise).and_return(task)
allow(Proforma::Exporter).to receive(:new).with(task: task, custom_namespaces: [{prefix: 'openHPI', uri: 'open.hpi.de'}]).and_return(exporter) allow(Proforma::Exporter).to receive(:new).with(task: task, custom_namespaces: [{prefix: 'CodeOcean', uri: 'codeocean.openhpi.de'}]).and_return(exporter)
end end
it do it do