From a568103a60d3f13d2db388e6228ed142174aa870 Mon Sep 17 00:00:00 2001 From: Midgard Date: Mon, 2 May 2022 22:00:37 +0200 Subject: [PATCH] You didn't see this --- app/models/order.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/models/order.py b/app/models/order.py index 31f5620..255704a 100644 --- a/app/models/order.py +++ b/app/models/order.py @@ -118,13 +118,9 @@ class Order(db.Model): def can_modify_prices(self, user_id: int) -> bool: if not self.is_closed(): return False - if user_id is None: - return False - if self.courier_id == user_id: - return True user = User.query.filter_by(id=user_id).first() - return user and user.is_admin() + return user and (user.is_admin() or user == self.courier) def can_modify_payment(self, user_id: int) -> bool: user = User.query.filter_by(id=user_id).first() - return user and (user.is_admin() or user == self.order.courier) + return user and (user.is_admin() or user == self.courier)