예제 #1
0
    def tearDown(self) -> None:
        self.from_location_1.delete()
        self.to_location_1.delete()
        self.from_location_2.delete()
        self.to_location_2.delete()

        for booking_id in self.booking_id_to_delete:
            RiderBooking.get(doc_id=booking_id).delete()
예제 #2
0
        def _add_rider_transactional(transaction, orbit_id, booking_id,
                                     **kwargs):
            orbit = cls.get(doc_id=orbit_id, transaction=transaction)
            rider_booking = RiderBooking.get(doc_id=booking_id,
                                             transaction=transaction)
            orbit._add_rider(rider_booking, **kwargs)

            orbit.save(transaction=transaction)
            rider_booking.save(transaction=transaction)
예제 #3
0
        def _match_transactional(transaction,
                                 orbit_id=None,
                                 hosting_id=None,
                                 rider_records=None):
            if orbit_id is None:
                orbit: Orbit = cls.new(status="open", transaction=transaction)
            else:
                orbit = cls.get(doc_id=orbit_id, transaction=transaction)
            ride_host = RideHost.get(doc_id=hosting_id,
                                     transaction=transaction)
            orbit._add_host(ride_host)

            for booking_id, pickup_sublocation_id, dropoff_sublocation_id in rider_records:
                rider_booking = RiderBooking.get(doc_id=booking_id,
                                                 transaction=transaction)
                orbit._add_rider(rider_booking=rider_booking,
                                 pickup_sublocation_id=pickup_sublocation_id,
                                 dropoff_sublocation_id=dropoff_sublocation_id)
                # rider_booking.save(transaction=transaction)

            orbit.save(transaction=transaction)