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
use dentaku with fixed handling of modulo 0
Ivan Kuchineea61ccb1a82
diff --git a/Gemfile b/Gemfileindex e29497d5d3e..79004362cd3 100644--- a/Gemfile+++ b/Gemfile@@ -387,7 +387,7 @@ gem "googleauth", require: falsegem "disposable", "~> 0.6.2"# Used for formula evaluation of calculated values-gem "dentaku", "~> 3.5"+gem "dentaku", "~> 3.5", git: "https://github.com/rubysolo/dentaku", ref: "f17d427b63ef7e9ed8f914b5cb1d0645a37f9ebb"group :postgres dogem "pg", "~> 1.5.0"diff --git a/Gemfile.lock b/Gemfile.lockindex d28ebe89689..8e766a0325b 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -61,6 +61,15 @@ GITparallel_tests (>= 3.3.0, < 5)rspec (>= 3.10)+GIT+ remote: https://github.com/rubysolo/dentaku+ revision: f17d427b63ef7e9ed8f914b5cb1d0645a37f9ebb+ ref: f17d427b63ef7e9ed8f914b5cb1d0645a37f9ebb+ specs:+ dentaku (3.5.4)+ bigdecimal+ concurrent-ruby+PATHremote: modules/auth_pluginsspecs:@@ -466,9 +475,6 @@ GEMdeckar01-task_list (2.3.4)html-pipeline (~> 2.0)declarative (0.0.20)- dentaku (3.5.4)- bigdecimal- concurrent-rubydescendants_tracker (0.0.4)thread_safe (~> 0.3, >= 0.3.1)diff-lcs (1.6.2)@@ -1368,7 +1374,7 @@ DEPENDENCIESdashboards!date_validator (~> 0.12.0)deckar01-task_list (~> 2.3.1)- dentaku (~> 3.5)+ dentaku (~> 3.5)!disposable (~> 0.6.2)doorkeeper (~> 5.8.0)dotenv-rails@@ -1635,7 +1641,7 @@ CHECKSUMSdate_validator (0.12.0) sha256=68c9834da240347b9c17441c553a183572508617ebfbe8c020020f3192ce3058deckar01-task_list (2.3.4) sha256=66abdc7e009ea759732bb53867e1ea42de550e2aa03ac30a015cbf42a04c1667declarative (0.0.20) sha256=8021dd6cb17ab2b61233c56903d3f5a259c5cf43c80ff332d447d395b17d9ff9- dentaku (3.5.4) sha256=0f897acf360776c43c3b3629134224abbf6a90a59084707af6e194c5d69ad9c7+ dentaku (3.5.4)descendants_tracker (0.0.4) sha256=e9c41dd4cfbb85829a9301ea7e7c48c2a03b26f09319db230e6479ccdc780897diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962disposable (0.6.3) sha256=7f2a3fb251bff6cd83f25b164043d4ec3531209b51b066ed476a9df9c2d384ccdiff --git a/app/models/acts_as_customizable/calculated_value.rb b/app/models/acts_as_customizable/calculated_value.rbindex d3111232bbc..9984f8f207b 100644--- a/app/models/acts_as_customizable/calculated_value.rb+++ b/app/models/acts_as_customizable/calculated_value.rb@@ -54,11 +54,7 @@ module ActsAsCustomizable::CalculatedValuecalculator = CustomField::CalculatedValue.calculator_instancecalculator.store(given)- begin- calculator.solve(to_compute).reject { |_, value| value == :undefined }- rescue ZeroDivisionError # https://github.com/rubysolo/dentaku/pull/322- {}- end+ calculator.solve(to_compute).reject { |_, value| value == :undefined }enddef calculated_value_fields_referenced_values(custom_fields)diff --git a/spec/models/acts_as_customizable/calculated_value_spec.rb b/spec/models/acts_as_customizable/calculated_value_spec.rbindex ba6c382c8c7..462b4d27ef8 100644--- a/spec/models/acts_as_customizable/calculated_value_spec.rb+++ b/spec/models/acts_as_customizable/calculated_value_spec.rb@@ -129,24 +129,11 @@ RSpec.describe ActsAsCustomizable::CalculatedValue, with_flag: { calculated_valuit "blanks field with modulo zero, but calculates other field" doinstance.calculate_custom_fields([cf_mod, cf_add])- # https://github.com/rubysolo/dentaku/pull/322- begin- Dentaku::Calculator.new.evaluate("1 % 0")-- expect(instance).to have_received(:custom_field_values=)- .with(- cf_mod.id => nil,- cf_add.id => 3- )-- fail "TODO: remove alternative check"- rescue ZeroDivisionError- expect(instance).to have_received(:custom_field_values=)- .with(- cf_mod.id => nil,- cf_add.id => nil- )- end+ expect(instance).to have_received(:custom_field_values=)+ .with(+ cf_mod.id => nil,+ cf_add.id => 3+ )endend