Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#58160] refactor

Tobias Dillmann9029c0db2dfc
diff --git a/app/components/projects/row_component.rb b/app/components/projects/row_component.rb
index 4bae6784d01..80d6e445600 100644
--- a/app/components/projects/row_component.rb
+++ b/app/components/projects/row_component.rb
@@ -99,10 +99,9 @@ module Projects
def life_cycle_step_column(column)
return nil unless user_can_view_project?
- # FIXME: make this efficient
ls = Project::LifeCycleStep
.where(active: true)
- .find_by(definition_id: column.life_cycle_step.id, project:)
+ .find_by(definition_id: column.life_cycle.id, project:)
return nil if ls.blank?
diff --git a/app/models/queries/projects/selects/life_cycle_step.rb b/app/models/queries/projects/selects/life_cycle_step.rb
index 7a055a7d30f..028b9ad72c0 100644
--- a/app/models/queries/projects/selects/life_cycle_step.rb
+++ b/app/models/queries/projects/selects/life_cycle_step.rb
@@ -44,32 +44,32 @@ class Queries::Projects::Selects::LifeCycleStep < Queries::Selects::Base
end
def caption
- life_cycle_step.name
+ life_cycle.name
end
- def life_cycle_step
- return @life_cycle_step if defined?(@life_cycle_step)
+ def life_cycle
+ return @life_cycle if defined?(@life_cycle)
- @life_cycle_step = Project::LifeCycleStepDefinition
- .find_by(id: attribute[KEY, 1])
+ @life_cycle = Project::LifeCycleStepDefinition
+ .find_by(id: attribute[KEY, 1])
end
def available?
- life_cycle_step.present?
+ life_cycle.present?
end
def action_menu_header(button)
# Show the proper icon for the definition with the correct color.
- icon = case life_cycle_step
+ icon = case life_cycle
when Project::StageDefinition
:"git-commit"
when Project::GateDefinition
:diamond
else
- raise "Unknown life cycle step: #{life_cycle_step}"
+ raise "Unknown life cycle definition for: #{life_cycle}"
end
- classes = helpers.hl_inline_class("life_cycle_step_definition", life_cycle_step)
+ classes = helpers.hl_inline_class("life_cycle_step_definition", life_cycle)
button.with_leading_visual_icon(icon:, classes:)
# As all other action menu headers, we will show an action icon and the caption: