Fixed cache issue, added carpool support to orders

This commit is contained in:
Ed 2023-05-08 22:22:07 +02:00
parent 75fd737baa
commit 4295ff39e0
1 changed files with 8 additions and 4 deletions

8
ext.py
View File

@ -65,6 +65,7 @@ class Order:
self.is_fursuiter = True if self.ans('is_fursuiter') != 'No' else False
self.is_allergic = True if self.ans('is_allergic') != 'No' else False
self.propic_locked = self.ans('propic_locked')
self.carpooling_message = json.loads(self.ans('carpooling_message')) if self.ans('carpooling_message') else {}
self.birth_date = self.ans('birth_date')
self.name = self.ans('fursona_name')
self.room_id = self.ans('room_id')
@ -186,7 +187,9 @@ class OrderManager:
data = res.json()
for o in data['results']:
o = Order(o)
if o.status in ['canceled', 'expired']: continue
if o.status in ['canceled', 'expired']:
self.remove_cache(order)
else:
self.add_cache(Order(o))
# If a cached order is needed, just get it if available
@ -214,9 +217,10 @@ class OrderManager:
order = Order(res)
if order.status in ['canceled', 'expired']:
self.remove_cache(order)
if request:
raise exceptions.Forbidden(f"Your order has been deleted. Contact support with your order identifier ({res['code']}) for further info.")
else:
self.add_cache(order)
if request and secret != res['secret']: