Skip to content

Commit

Permalink
Filter fake timewindows in solution
Browse files Browse the repository at this point in the history
  • Loading branch information
braktar authored and frodrigo committed Dec 20, 2024
1 parent 200471f commit ad9d3a4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion models/solution/stop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def initialize(object, options = {})
when 'Hash'
object # Allow direct loading of json solution
else
raise 'Unknown stop class'

raise "Unknown stop class: #{object.class.to_s} #{object.inspect}"
end
raise 'A route stop cannot be nil' unless parsed_object

Expand All @@ -64,6 +65,7 @@ def vrp_result(options = {})
options[:apply] ||= []
options[:apply] << [:setup]
end
filter_fake_timewindow
hash = super(options)
hash['original_service_id'] = id
hash.merge!(info.vrp_result(options))
Expand Down Expand Up @@ -97,6 +99,12 @@ def build_skills
skills_to_output
end

def filter_fake_timewindow
return if activity.timewindows.size != 1

activity.timewindows = [] if activity.timewindows.first.start == 0 && activity.timewindows.first.end.nil?
end

def active_timewindow
return nil if activity.timewindows.empty?

Expand Down

0 comments on commit ad9d3a4

Please sign in to comment.