Skip to content

Commit

Permalink
Don't check the schedule when making the plan call for whitelisted users
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekEdwards committed May 22, 2017
1 parent 520a5aa commit 11c5dc2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/trip_part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 11c5dc2

Please sign in to comment.