Exemplo n.º 1
0
    def end_ride(self, ride_id, location):
        """
        Wraps a `run_transaction` call that ends a ride.

        Arguments:
            ride_id {UUID} -- The ride's unique ID.
            location {String} -- The vehicle's last location.
        """
        return run_transaction(
            self.sessionmaker,
            lambda session: end_ride_txn(session, ride_id, location))
Exemplo n.º 2
0
    def end_ride(self, ride_id, new_longitude, new_latitude, new_battery):
        """
        Wraps a `run_transaction` call that ends a ride.

        Updates position (lat & long), battery & timestamp.

        Arguments:
            ride_id {UUID}
            new_longitude {float} -- Vehicle's new longitude coordinate
            new_latitude {float} -- Vehicle's new latitude coordinate
            new_battery {int} -- Vehicle's new battery reading

        Returns:
            {datetime} -- Timestamp of the end of the ride from the server.
        """
        return run_transaction(
            self.sessionfactory, lambda session: end_ride_txn(
                session, ride_id, new_longitude, new_latitude, new_battery))