Skip to content

Commit

Permalink
Merge pull request #290 from braktar/dev
Browse files Browse the repository at this point in the history
Fix default quantity value
  • Loading branch information
fab-girard committed Sep 29, 2021
2 parents 8fc0e1d + 5a0e84a commit 08f8349
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion models/quantity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Models
class Quantity < Base
field :fill, default: false
field :empty, default: false
field :value
field :value, default: 0
field :setup_value, default: 1

# ActiveHash doesn't validate the validator of the associated objects
Expand Down
5 changes: 5 additions & 0 deletions test/wrapper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3086,6 +3086,11 @@ def test_assert_inapplicable_relations
refute_includes OptimizerWrapper.config[:services][:vroom].inapplicable_solve?(vrp),
:assert_no_relations_except_simple_shipments

problem[:services][0][:quantities] = [{ unit_id: 'kg', value: nil }]
vrp = TestHelper.create(problem)
assert_includes OptimizerWrapper.config[:services][:vroom].inapplicable_solve?(vrp),
:assert_no_relations_except_simple_shipments

problem[:services][1][:quantities] = [{ unit_id: 'kg', value: 2 }]
vrp = TestHelper.create(problem)
assert_includes OptimizerWrapper.config[:services][:vroom].inapplicable_solve?(vrp),
Expand Down

0 comments on commit 08f8349

Please sign in to comment.