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

[#64347] use Dentaku instance instead of shortcut

Tobias Dillmanne30f7a958824
diff --git a/app/models/custom_field/calculated_value.rb b/app/models/custom_field/calculated_value.rb
index f9995e52e25..64f2d4753d1 100644
--- a/app/models/custom_field/calculated_value.rb
+++ b/app/models/custom_field/calculated_value.rb
@@ -48,8 +48,8 @@ module CustomField::CalculatedValue
# Dentaku will return nil if the formula is invalid.
# TODO WP-64348: add support for referenced custom fields by injecting them as variables,
- # e.g. Dentaku(formula_string, cf_123: CustomField.find(123).value)
- errors.add(:formula, :invalid) unless Dentaku(formula_string)
+ # e.g. calculator.evaluate(formula_string, cf_123: CustomField.find(123).value)
+ errors.add(:formula, :invalid) unless Dentaku::Calculator.new.evaluate(formula_string)
# TODO: consider differentiating between a formula that contains missing variables, invalid
# syntax, or mathematical errors.