mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-17 01:06:30 +08:00
Fix failing test [SCI-3037]
This commit is contained in:
parent
7854b9d281
commit
f3ad4f7fc9
4 changed files with 23 additions and 35 deletions
|
@ -48,9 +48,7 @@ module ModelExporters
|
||||||
task_comments: my_module.task_comments,
|
task_comments: my_module.task_comments,
|
||||||
my_module_repository_rows: my_module.my_module_repository_rows,
|
my_module_repository_rows: my_module.my_module_repository_rows,
|
||||||
user_my_modules: my_module.user_my_modules,
|
user_my_modules: my_module.user_my_modules,
|
||||||
protocols: my_module.protocols.map do |pr|
|
protocols: my_module.protocols.map { |pr| protocol(pr) },
|
||||||
ProtocolExporter.new(pr.id).protocol
|
|
||||||
end,
|
|
||||||
results: my_module.results.map { |res| result(res) }
|
results: my_module.results.map { |res| result(res) }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,6 +42,27 @@ module ModelExporters
|
||||||
raise NotImplementedError, '#export_to_dir method not implemented.'
|
raise NotImplementedError, '#export_to_dir method not implemented.'
|
||||||
end
|
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)
|
def checklist(checklist)
|
||||||
{
|
{
|
||||||
checklist: checklist,
|
checklist: checklist,
|
||||||
|
|
|
@ -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
|
|
|
@ -55,7 +55,7 @@ module ModelExporters
|
||||||
repositories: team.repositories.map { |r| repository(r) },
|
repositories: team.repositories.map { |r| repository(r) },
|
||||||
tiny_mce_assets: team.tiny_mce_assets,
|
tiny_mce_assets: team.tiny_mce_assets,
|
||||||
protocols: team.protocols.where(my_module: nil).map do |pr|
|
protocols: team.protocols.where(my_module: nil).map do |pr|
|
||||||
ProtocolExporter.new(pr.id).protocol
|
protocol(pr)
|
||||||
end,
|
end,
|
||||||
protocol_keywords: team.protocol_keywords,
|
protocol_keywords: team.protocol_keywords,
|
||||||
projects: team.projects.map { |p| project(p) }
|
projects: team.projects.map { |p| project(p) }
|
||||||
|
|
Loading…
Add table
Reference in a new issue