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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix/decimal separator in overwritten costs (#8874)
ulferts511ab615fc8f
diff --git a/modules/budgets/app/models/budget.rb b/modules/budgets/app/models/budget.rbindex a81994b024d..560d7d7d0eb 100644--- a/modules/budgets/app/models/budget.rb+++ b/modules/budgets/app/models/budget.rb@@ -192,7 +192,9 @@ class Budget < ApplicationRecordmaterial_budget_item_attributes.each do |_index, attributes|correct_material_attributes!(attributes)- material_budget_items.build(attributes) if attributes[:units].to_f.positive?+ if valid_material_budget_attributes?(attributes)+ material_budget_items.build(attributes)+ endendend@@ -233,12 +235,14 @@ class Budget < ApplicationRecordreturn unless attributesattributes[:hours] = Rate.parse_number_string_to_number(attributes[:hours])+ attributes[:amount] = Rate.parse_number_string(attributes[:amount])enddef correct_material_attributes!(attributes)return unless attributesattributes[:units] = Rate.parse_number_string_to_number(attributes[:units])+ attributes[:amount] = Rate.parse_number_string(attributes[:amount])enddef update_budget_item_attributes(budget_item_attributes, type:)@@ -251,7 +255,7 @@ class Budget < ApplicationRecordsend("correct_#{type}_attributes!", attributes)if send("valid_#{type}_budget_attributes?", attributes)- budget_item.attributes = attributes.merge(amount: Rate.parse_number_string(attributes[:amount]))+ budget_item.attributes = attributeselse# This is surprising as it will delete right away compared to the# update of the attributes that requires a save afterwards to take effect.diff --git a/modules/budgets/spec/features/budgets/copy_budget_spec.rb b/modules/budgets/spec/features/budgets/copy_budget_spec.rbindex 106b11a34e3..b76817ace09 100644--- a/modules/budgets/spec/features/budgets/copy_budget_spec.rb+++ b/modules/budgets/spec/features/budgets/copy_budget_spec.rb@@ -61,7 +61,7 @@ describe 'Copying a budget', type: :feature, js: true dounits: 10,cost_type: cost_type,budget: budget,- amount: 60.00+ amount: 600000.00endlet!(:labor_budget_item) do@@ -85,7 +85,7 @@ describe 'Copying a budget', type: :feature, js: true dobudget_page.expect_planned_costs!(type: :labor, row: 1, expected: '125.00 EUR')budget_page.expect_planned_costs!(type: :material, row: 1, expected: '150.00 EUR')- budget_page.expect_planned_costs!(type: :material, row: 2, expected: '60.00 EUR')+ budget_page.expect_planned_costs!(type: :material, row: 2, expected: '600,000.00 EUR')click_button 'Create'