Fix failing test [SCI-3037]

This commit is contained in:
Oleksii Kriuchykhin 2019-02-12 13:38:59 +01:00
parent 7854b9d281
commit f3ad4f7fc9
4 changed files with 23 additions and 35 deletions

View file

@ -48,9 +48,7 @@ module ModelExporters
task_comments: my_module.task_comments,
my_module_repository_rows: my_module.my_module_repository_rows,
user_my_modules: my_module.user_my_modules,
protocols: my_module.protocols.map do |pr|
ProtocolExporter.new(pr.id).protocol
end,
protocols: my_module.protocols.map { |pr| protocol(pr) },
results: my_module.results.map { |res| result(res) }
}
end

View file

@ -42,6 +42,27 @@ module ModelExporters
raise NotImplementedError, '#export_to_dir method not implemented.'
end
def protocol(protocol)
{
protocol: protocol,
protocol_protocol_keywords: protocol.protocol_protocol_keywords,
steps: protocol.steps.map { |s| step(s) }
}
end
def step(step)
@assets_to_copy.push(step.assets.to_a) if step.assets.present?
{
step: step,
checklists: step.checklists.map { |c| checklist(c) },
step_comments: step.step_comments,
step_assets: step.step_assets,
assets: step.assets,
step_tables: step.step_tables,
tables: step.tables.map { |t| table(t) }
}
end
def checklist(checklist)
{
checklist: checklist,

View file

@ -1,31 +0,0 @@
# frozen_string_literal: true
module ModelExporters
class ProtocolExporter < ModelExporter
def initialize(protocol_id)
super()
@protocol = Protocol.find(protocol_id)
end
def protocol
{
protocol: @protocol,
protocol_protocol_keywords: @protocol.protocol_protocol_keywords,
steps: @protocol.steps.map { |s| step(s) }
}
end
def step(step)
@assets_to_copy.push(step.assets.to_a) if step.assets.present?
{
step: step,
checklists: step.checklists.map { |c| checklist(c) },
step_comments: step.step_comments,
step_assets: step.step_assets,
assets: step.assets,
step_tables: step.step_tables,
tables: step.tables.map { |t| table(t) }
}
end
end
end

View file

@ -55,7 +55,7 @@ module ModelExporters
repositories: team.repositories.map { |r| repository(r) },
tiny_mce_assets: team.tiny_mce_assets,
protocols: team.protocols.where(my_module: nil).map do |pr|
ProtocolExporter.new(pr.id).protocol
protocol(pr)
end,
protocol_keywords: team.protocol_keywords,
projects: team.projects.map { |p| project(p) }