diff --git a/app/services/proforma_service/convert_exercise_to_task.rb b/app/services/proforma_service/convert_exercise_to_task.rb index ce861120..27836f91 100644 --- a/app/services/proforma_service/convert_exercise_to_task.rb +++ b/app/services/proforma_service/convert_exercise_to_task.rb @@ -88,7 +88,7 @@ module ProformaService def task_file(file) task_file = Proforma::TaskFile.new( id: file.id, - filename: file.path.present? && file.path != '.' ? ::File.join(file.path, file.name_with_extension) : file.name_with_extension, + filename: filename(file), usage_by_lms: file.read_only ? 'display' : 'edit', visible: file.hidden ? 'no' : 'yes', internal_description: file.role || 'regular_file' @@ -97,6 +97,10 @@ module ProformaService task_file end + def filename(file) + file.path.present? && file.path != '.' ? ::File.join(file.path, file.name_with_extension) : file.name_with_extension + end + def add_content_to_task_file(file, task_file) if file.native_file.present? file = ::File.new(file.native_file.file.path, 'r')