From 11c5dc22a25a927c7ea231dc09958b0d6f51b7ed Mon Sep 17 00:00:00 2001 From: Derek Edwards Date: Mon, 22 May 2017 11:14:31 -0400 Subject: [PATCH] Don't check the schedule when making the plan call for whitelisted users --- app/models/trip_part.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/trip_part.rb b/app/models/trip_part.rb index 4001c87f..d6167046 100644 --- a/app/models/trip_part.rb +++ b/app/models/trip_part.rb @@ -648,6 +648,13 @@ def valid_for_schedule?(schedule) # Returns true/false if trip_part is valid for any of the passed service's schedules # Returns true if passed a nil service, or a service with no schedules def valid_for_service_time?(service) + + # Check to see if user is whitelisted + user_service = self.trip.user.user_profile.user_services.find_by(service: service) + if user_service and user_service.unrestricted_hours + return true + end + return true if service.nil? or service.schedules.count == 0 service.schedules.any? { |sched| valid_for_schedule?(sched) } end