fix cognitive complexity

This commit is contained in:
Karol
2019-12-10 17:34:02 +01:00
parent 17aa44a444
commit 8ba764044a

View File

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