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
[#64348] Use lookaheads/-behinds to get rid of flatten and compact
Tobias Dillmann855810e400ce
diff --git a/app/models/custom_field/calculated_value.rb b/app/models/custom_field/calculated_value.rbindex 9fcfd3e0038..396a466f8ee 100644--- a/app/models/custom_field/calculated_value.rb+++ b/app/models/custom_field/calculated_value.rb@@ -129,7 +129,7 @@ module CustomField::CalculatedValue# Returns a list of custom field IDs used in the formula.# For a formula like `2 + {{cf_12}} + {{cf_4}}` it returns `[12, 4]`.def cf_ids_used_in_formula(formula_str)- formula_str.scan(/\{\{cf_(\d+)}}/).flatten.compact.map(&:to_i)+ formula_str.scan(/(?<=\{\{cf_)\d+(?=}})/).map(&:to_i)end# Returns `formula_string` with all custom field references detokenized so that they are parseable by Dentaku.