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

Use 'field' mode when setting does not exist in database yet

Christophe Bliard43f8d8aee9a3
diff --git a/db/migrate/20240402072213_update_progress_calculation.rb b/db/migrate/20240402072213_update_progress_calculation.rb
index ee8743dbb88..e1588ed4b69 100644
--- a/db/migrate/20240402072213_update_progress_calculation.rb
+++ b/db/migrate/20240402072213_update_progress_calculation.rb
@@ -13,10 +13,11 @@ class UpdateProgressCalculation < ActiveRecord::Migration[7.1]
end
def progress_calculation_mode
- ActiveRecord::Base.connection
+ value_from_db = ActiveRecord::Base.connection
.execute("SELECT value FROM settings WHERE name = 'work_package_done_ratio'")
.first
&.fetch("value", nil)
+ value_from_db || "field"
end
def set_progress_calculation_mode_to_work_based