Esempio n. 1
0
 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)
Esempio n. 2
0
 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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)