def _directions(self, stops): """ Compute capacity and passenger count, then return Google Maps directions. """ load = 0 for stop in stops: load -= len(getattr(stop, self.DROPOFF_ATTR)) load += len(getattr(stop, self.PICKUP_ATTR)) if load > self.route.vehicle.capacity: stop.over_capacity = True stop.passenger_count = load return get_directions(stops)
def _directions(self, stops): """ Compute capacity and passenger count, then return Google Maps directions. """ load = 0 for stop in stops: load -= len(getattr(stop, self.DROPOFF_ATTR)) load += len(getattr(stop, self.PICKUP_ATTR)) if load > self.route.vehicle.capacity: stop.over_capacity = True stop.passenger_count = load return get_directions(stops)
def directions(self): """ Directions from Hanover to the Lodge, with information about where to dropoff and pick up each trip. TODO: refactor """ load = 0 for stop in self.all_stops: for trip in stop.trips_picked_up: load += trip.size for trip in stop.trips_dropped_off: load -= trip.size if load > self.route.vehicle.capacity: stop.over_capacity = True else: stop.over_capacity = False stop.passenger_count = load return get_directions(self.all_stops)
def directions(self): """ Directions from Hanover to the Lodge, with information about where to dropoff and pick up each trip. TODO: refactor """ stops = self.get_stops() load = 0 for stop in stops: for trip in stop.trips_picked_up: load += trip.size() for trip in stop.trips_dropped_off: load -= trip.size() if load > self.route.vehicle.capacity: stop.over_capacity = True else: stop.over_capacity = False stop.passenger_count = load return get_directions(stops)