Ejemplo 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)
Ejemplo 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)
Ejemplo 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)
Ejemplo 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)