From 838019343e6b1920d29bdcf03a004fcf9114f835 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 8 Dec 2022 10:57:36 +0100 Subject: [PATCH] ProFormA: Hide 'delayed' files by default --- app/services/proforma_service/convert_task_to_exercise.rb | 2 +- .../proforma_service/convert_task_to_exercise_spec.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/services/proforma_service/convert_task_to_exercise.rb b/app/services/proforma_service/convert_task_to_exercise.rb index 9350babc..222a56b8 100644 --- a/app/services/proforma_service/convert_task_to_exercise.rb +++ b/app/services/proforma_service/convert_task_to_exercise.rb @@ -86,7 +86,7 @@ module ProformaService codeocean_file = CodeOcean::File.new( context: @exercise, file_type: file_type(extension), - hidden: file.visible == 'no', + hidden: file.visible != 'yes', # hides 'delayed' and 'no' name: File.basename(file.filename, '.*'), read_only: file.usage_by_lms != 'edit', role: @task.meta_data[:CodeOcean]&.dig(:files)&.dig("CO-#{file.id}".to_sym)&.dig(:role), diff --git a/spec/services/proforma_service/convert_task_to_exercise_spec.rb b/spec/services/proforma_service/convert_task_to_exercise_spec.rb index a2b17bd5..b5b685d7 100644 --- a/spec/services/proforma_service/convert_task_to_exercise_spec.rb +++ b/spec/services/proforma_service/convert_task_to_exercise_spec.rb @@ -472,7 +472,7 @@ describe ProformaService::ConvertTaskToExercise do content: 'ms-content', filename: 'filename.txt', used_by_grader: 'used_by_grader', - visible: 'yes', + visible: 'delayed', usage_by_lms: 'display', binary: false, internal_description: 'reference_implementation' @@ -483,9 +483,9 @@ describe ProformaService::ConvertTaskToExercise do expect(convert_to_exercise_service).to have_attributes( id: exercise.id, files: have(3).items - .and(include(have_attributes(content: 'ms-content', role: 'reference_implementation'))) - .and(include(have_attributes(content: 'content', role: 'regular_file'))) - .and(include(have_attributes(content: 'testfile-content', role: 'teacher_defined_test'))) + .and(include(have_attributes(content: 'ms-content', role: 'reference_implementation', hidden: true))) + .and(include(have_attributes(content: 'content', role: 'regular_file', hidden: false))) + .and(include(have_attributes(content: 'testfile-content', role: 'teacher_defined_test', hidden: true))) ) end end