Skip to content

Commit

Permalink
refactor: encasulate order_purposes_for_pipelines method to reduce ABC
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHulme committed Mar 7, 2024
1 parent cd81fe8 commit 0680cdd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/controllers/pipeline_progress_overview_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def show
# "child" => nil
# }
@purpose_pipeline_map = Settings.pipelines.purpose_to_pipelines_map(@ordered_purpose_list, @pipelines_for_group)
@ordered_purposes_for_pipelines =
@pipelines_for_group.index_with { |pipeline| Settings.pipelines.order_pipeline(pipeline) }
@ordered_purposes_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)
Expand All @@ -41,6 +40,10 @@ def from_date(params)
params[:date]&.to_date || Time.zone.today.prev_month
end

def order_purposes_for_pipelines(pipeline_names)
pipeline_names.index_with { |pipeline_name| Settings.pipelines.order_pipeline(pipeline_name) }
end

# Filter out labware that is not related of the given list of purpose names.
# A labware is related to a purpose if it is that purpose or has an ancestor
# that is that purpose.
Expand Down

0 comments on commit 0680cdd

Please sign in to comment.