Skip to content

Commit

Permalink
Fix: check direct shipments correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
senhalil committed Oct 18, 2021
1 parent b8a8ff9 commit c1a600b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion wrappers/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,15 @@ def assert_no_relations_except_simple_shipments(vrp)
vrp.units.each{ |unit| quantities[unit.id] = [] }
r.linked_services.first.quantities.each{ |q| quantities[q.unit.id] << q.value }
r.linked_services.last.quantities.each{ |q| quantities[q.unit.id] << q.value }
quantities.all?{ |_unit, values|
next false unless quantities.all?{ |_unit, values|
values.empty? || (values.size == 2 && values.first >= 0 && values.first == -values.last)
}

next false if vrp.relations.any?{ |inner_r| # direct shipments
inner_r.type == :sequence && (r.linked_ids - inner_r.linked_ids).empty?
}

true
}
end

Expand Down

0 comments on commit c1a600b

Please sign in to comment.