Skip to content

Commit

Permalink
[#58160] Use index_by to fetch single value per key
Browse files Browse the repository at this point in the history
  • Loading branch information
EinLama committed Dec 16, 2024
1 parent 1461de2 commit a9ee77b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/components/projects/table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def favored_project_ids
def project_life_cycle_step_by_definition(definition, project)
@project_life_cycle_steps_by_definition ||= Project::LifeCycleStep
.where(active: true)
.group_by { |s| [s.definition_id, s.project_id] }
.index_by { |s| [s.definition_id, s.project_id] }

@project_life_cycle_steps_by_definition[[definition.id, project.id]]&.first
@project_life_cycle_steps_by_definition[[definition.id, project.id]]
end

def sorted_by_lft?
Expand Down

0 comments on commit a9ee77b

Please sign in to comment.