fix cognitive complexity
This commit is contained in:
@ -88,7 +88,7 @@ module ProformaService
|
|||||||
def task_file(file)
|
def task_file(file)
|
||||||
task_file = Proforma::TaskFile.new(
|
task_file = Proforma::TaskFile.new(
|
||||||
id: file.id,
|
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',
|
usage_by_lms: file.read_only ? 'display' : 'edit',
|
||||||
visible: file.hidden ? 'no' : 'yes',
|
visible: file.hidden ? 'no' : 'yes',
|
||||||
internal_description: file.role || 'regular_file'
|
internal_description: file.role || 'regular_file'
|
||||||
@ -97,6 +97,10 @@ module ProformaService
|
|||||||
task_file
|
task_file
|
||||||
end
|
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)
|
def add_content_to_task_file(file, task_file)
|
||||||
if file.native_file.present?
|
if file.native_file.present?
|
||||||
file = ::File.new(file.native_file.file.path, 'r')
|
file = ::File.new(file.native_file.file.path, 'r')
|
||||||
|
Reference in New Issue
Block a user