Skip to content

Commit

Permalink
Fix staff email reservation notification (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezkat authored Nov 2, 2023
1 parent 3cdb616 commit 4247a9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions payments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,8 @@ def get_price(self) -> Decimal:

def set_state(
self, new_state: str, log_message: str = None,
save: bool = True, update_reservation_state: bool = True
save: bool = True, update_reservation_state: bool = True,
**kwargs
) -> None:
assert new_state in (Order.WAITING, Order.CONFIRMED, Order.REJECTED, Order.EXPIRED, Order.CANCELLED)

Expand Down Expand Up @@ -843,9 +844,9 @@ def set_state(

if update_reservation_state:
if new_state == Order.CONFIRMED:
self.reservation.set_state(Reservation.CONFIRMED, None)
self.reservation.set_state(Reservation.CONFIRMED, kwargs.get('user', self.reservation.user))
elif new_state in (Order.REJECTED, Order.EXPIRED, Order.CANCELLED):
self.reservation.set_state(Reservation.CANCELLED, None)
self.reservation.set_state(Reservation.CANCELLED, kwargs.get('user', self.reservation.user))

if save:
self.save()
Expand Down
2 changes: 1 addition & 1 deletion resources/api/reservation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ def perform_destroy(self, instance):
instance.set_state(Reservation.CANCELLED, self.request.user)
if instance.has_order():
order = instance.get_order()
order.set_state(Order.CANCELLED, 'Order reservation was cancelled.')
order.set_state(Order.CANCELLED, 'Order reservation was cancelled.', user = self.request.user)

def list(self, request, *args, **kwargs):
response = super().list(request, *args, **kwargs)
Expand Down

0 comments on commit 4247a9f

Please sign in to comment.