diff --git a/models/concerns/periodic_service.rb b/models/concerns/periodic_service.rb index 6c0608cae..c5672dcf5 100644 --- a/models/concerns/periodic_service.rb +++ b/models/concerns/periodic_service.rb @@ -21,6 +21,8 @@ module PeriodicService extend ActiveSupport::Concern def can_affect_all_visits?(service) + return true unless self.schedule? + return true if service.visits_number == 1 self.vehicles.any?{ |vehicle| diff --git a/wrappers/wrapper.rb b/wrappers/wrapper.rb index 2df158191..af708f8f2 100644 --- a/wrappers/wrapper.rb +++ b/wrappers/wrapper.rb @@ -686,6 +686,8 @@ def compute_vehicles_capacity(vrp) end def possible_days_are_consistent(vrp, service) + return true unless vrp.schedule? + return false if service.first_possible_days.any?{ |d| d > vrp.schedule_range_indices[:end] } return false if service.last_possible_days.any?{ |d| d < vrp.schedule_range_indices[:start] } @@ -747,8 +749,6 @@ def detect_unfeasible_services(vrp) detect_inconsistent_relation_timewindows_od_service(vrp, unfeasible, service) # Planning inconsistency - next if !vrp.schedule? - unless possible_days_are_consistent(vrp, service) add_unassigned(unfeasible, vrp, service, 'Provided possible days do not allow service to be assigned') end