diff --git a/app/controllers/concerns/report_actions.rb b/app/controllers/concerns/report_actions.rb index e301aa1a6..d6ce386c1 100644 --- a/app/controllers/concerns/report_actions.rb +++ b/app/controllers/concerns/report_actions.rb @@ -52,7 +52,7 @@ module ReportActions def generate_experiment_contents_json(experiment, selected_modules) res = [] - experiment.my_modules.each do |my_module| + experiment.my_modules.order(:workflow_order).each do |my_module| next unless selected_modules.include?(my_module.id) res << generate_new_el(false) diff --git a/app/models/protocol.rb b/app/models/protocol.rb index dd10997a4..8f4049561 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -372,7 +372,7 @@ class Protocol < ActiveRecord::Base end def completed_steps - steps.select(&:completed) + steps.where(completed: true) end def space_taken diff --git a/config/initializers/extends/report_extends.rb b/config/initializers/extends/report_extends.rb index d243c6bb0..3245d8af0 100644 --- a/config/initializers/extends/report_extends.rb +++ b/config/initializers/extends/report_extends.rb @@ -52,7 +52,7 @@ module ReportExtends true, [:step], proc do |my_module| - my_module.protocol.completed_steps + my_module.protocol.completed_steps.order(:position) end), ModuleElement.new(:result_assets, true,