diff --git a/app/controllers/pipeline_progress_overview_controller.rb b/app/controllers/pipeline_progress_overview_controller.rb index 199a5de0a..427a03bda 100644 --- a/app/controllers/pipeline_progress_overview_controller.rb +++ b/app/controllers/pipeline_progress_overview_controller.rb @@ -13,27 +13,39 @@ def show # Pipeline details - # hash of pipelines by group + # ["scRNA Core Cell Extraction Entry", "scRNA Core Cell Extraction Seq", "scRNA Core Cell Extraction Spare"] @pipelines_for_group = Settings.pipelines.retrieve_pipeline_config_for_group(@pipeline_group_name) - # list of group-purposes in order - @ordered_purpose_list = Settings.pipelines.combine_and_order_pipelines(@pipelines_for_group) - - # purpose_pipeline_map is a hash of hashes, like: - # "Purpose 2" => { - # "Pipeline A" => { - # "parent" => "Purpose 1", - # "child" => "Purpose 3" - # }, - # "Pipeline B" => { - # "parents" => "Purpose 1", - # "child" => nil + # ["LRC Blood Vac", "LRC Blood Aliquot", "LRC Blood Bank", "LRC PBMC Bank", "LRC Bank Seq", "LRC Bank Spare"] + @ordered_purpose_names = Settings.pipelines.combine_and_order_pipelines(@pipelines_for_group) + + # { + # 'LRC Blood Vac' => { + # 'scRNA Core Cell Extraction Entry' => { + # parent: nil, + # child: 'LRC Blood Aliquot' + # } + # }, + # 'LRC Blood Aliquot' => { + # 'scRNA Core Cell Extraction Entry' => { + # parent: 'LRC Blood Vac', + # child: 'LRC Blood Bank' # } - @purpose_pipeline_map = Settings.pipelines.purpose_to_pipelines_map(@ordered_purpose_list, @pipelines_for_group) - @ordered_purposes_for_pipelines = order_purposes_for_pipelines(@pipelines_for_group) + # }, + # ... + # } + @purpose_pipeline_details = + Settings.pipelines.purpose_to_pipelines_map(@ordered_purpose_names, @pipelines_for_group) + + # { + # 'scRNA Core Cell Extraction Entry' => ['LRC Blood Vac', 'LRC Blood Aliquot', 'LRC Blood Bank'], + # 'scRNA Core Cell Extraction Seq' => ['LRC Blood Bank', 'LRC PBMC Bank', 'LRC Bank Seq'], + # 'scRNA Core Cell Extraction Spare' => ['LRC PBMC Bank', 'LRC Bank Spare'] + # } + @ordered_purpose_names_for_pipelines = order_purposes_for_pipelines(@pipelines_for_group) # Labware results - @labware = compile_labware_for_purpose(@ordered_purpose_list, page_size, @from_date, @ordered_purpose_list) + @labware = compile_labware_for_purpose(@ordered_purpose_names, page_size, @from_date, @ordered_purpose_names) end def from_date(params) diff --git a/app/models/pipeline_list.rb b/app/models/pipeline_list.rb index 429a2fa7a..3c3d44ca1 100644 --- a/app/models/pipeline_list.rb +++ b/app/models/pipeline_list.rb @@ -24,8 +24,9 @@ def active_pipelines_for(labware) end # For the given pipeline group - # return a object with key: group, and value: list of the pipeline names in that group - # e.g {"Bespoke Chromium 3pv2"=>["Bespoke Chromium 3pv2", "Bespoke Chromium 3pv2 MX"]} + # return a list of the pipeline names in that group + # e.g "Bespoke Chromium 3pv2" + # =>["Bespoke Chromium 3pv2", "Bespoke Chromium 3pv2 MX"] def retrieve_pipeline_config_for_group(pipeline_group) @list.select { |pipeline| pipeline.pipeline_group == pipeline_group }.map(&:name) end diff --git a/app/views/pipeline_progress_overview/_purpose_graph.html.erb b/app/views/pipeline_progress_overview/_purpose_graph.html.erb index 9815be0bb..16524b842 100644 --- a/app/views/pipeline_progress_overview/_purpose_graph.html.erb +++ b/app/views/pipeline_progress_overview/_purpose_graph.html.erb @@ -8,7 +8,7 @@ # # @return [Boolean] Returns true if the pipeline is found in the keys of the purpose's pipeline map, false otherwise. def purpose_is_in_pipeline(pipeline_name, purpose_name) - @purpose_pipeline_map[purpose_name].keys.include?(pipeline_name) + @purpose_pipeline_details[purpose_name].keys.include?(pipeline_name) end # Checks if the first purpose in a pipeline has occurred. @@ -18,10 +18,10 @@ # # @return [Boolean] Returns true if the purpose is the first in the pipeline and has occurred, false otherwise. def pipeline_first_purpose_has_occurred(pipeline_name, purpose_name) - first_purpose_in_pipeline = @ordered_purposes_for_pipelines[pipeline_name].first + first_purpose_in_pipeline = @ordered_purpose_names_for_pipelines[pipeline_name].first # get list of purposes prior to the given purpose - purposes_prior_to_purpose = @ordered_purpose_list[0..@ordered_purpose_list.index(purpose_name)] + purposes_prior_to_purpose = @ordered_purpose_names[0..@ordered_purpose_names.index(purpose_name)] # has the first purpose in the pipeline occurred? purposes_prior_to_purpose.include?(first_purpose_in_pipeline) @@ -34,10 +34,10 @@ # # @return [Boolean] Returns true if the purpose is the last in the pipeline and has not occurred, false otherwise. def pipeline_last_purpose_is_still_to_occur(pipeline_name, purpose_name) - last_purpose_in_pipeline = @ordered_purposes_for_pipelines[pipeline_name].last + last_purpose_in_pipeline = @ordered_purpose_names_for_pipelines[pipeline_name].last # get list of purposes after the given purpose - purposes_after_purpose = @ordered_purpose_list[@ordered_purpose_list.index(purpose_name)..-1] + purposes_after_purpose = @ordered_purpose_names[@ordered_purpose_names.index(purpose_name)..-1] # has the last purpose in the pipeline occurred? purposes_after_purpose.include?(last_purpose_in_pipeline) @@ -50,11 +50,11 @@ end def is_first_purpose_in_pipeline(pipeline_name, purpose_name) - @ordered_purposes_for_pipelines[pipeline_name].first == purpose_name + @ordered_purpose_names_for_pipelines[pipeline_name].first == purpose_name end def is_last_purpose_in_pipeline(pipeline_name, purpose_name) - @ordered_purposes_for_pipelines[pipeline_name].last == purpose_name + @ordered_purpose_names_for_pipelines[pipeline_name].last == purpose_name end def graph_classes(pipeline_name, purpose_name) @@ -68,8 +68,8 @@ # "parents" => "Purpose 1", # "child" => nil # } - parent_purpose_name = @purpose_pipeline_map.dig(pipeline_name, purpose_name, 'parent') - child_purpose_name = @purpose_pipeline_map.dig(pipeline_name, purpose_name, 'child') + parent_purpose_name = @purpose_pipeline_details.dig(pipeline_name, purpose_name, 'parent') + child_purpose_name = @purpose_pipeline_details.dig(pipeline_name, purpose_name, 'child') # provide spacing classes = ['pipeline'] diff --git a/app/views/pipeline_progress_overview/show.html.erb b/app/views/pipeline_progress_overview/show.html.erb index 8c59b3567..e89a4967f 100644 --- a/app/views/pipeline_progress_overview/show.html.erb +++ b/app/views/pipeline_progress_overview/show.html.erb @@ -28,7 +28,7 @@

Purposes

- <% @ordered_purpose_list.each do |purpose_name| %> + <% @ordered_purpose_names.each do |purpose_name| %>
<%= render partial: 'purpose_graph', locals: { purpose_name: purpose_name } %> <%= render partial: 'purpose_card', locals: { purpose_name: purpose_name } %>