stranck-dev #25

Merged
drew merged 5 commits from stranck-dev into drew-dev 2024-05-13 10:17:12 +00:00
3 changed files with 19 additions and 13 deletions
Showing only changes of commit 383b5bbede - Show all commits

2
app.py
View File

@ -55,7 +55,7 @@ async def handleException(request, exception):
traceback.print_exc() traceback.print_exc()
if statusCode == 403: if statusCode == 403:
clear_session(r) await clear_session(r)
return r return r

View File

@ -80,6 +80,7 @@ async def send_unconfirm_message(room_order, orders):
issues_html += "</ul>" issues_html += "</ul>"
for member in orders: for member in orders:
if(member.status != 'canceled'):
plain_body = EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['plain'].format(member.name, room_order.room_name, issues_plain) plain_body = EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['plain'].format(member.name, room_order.room_name, issues_plain)
html_body = render_email_template(EMAILS_TEXT["ROOM_UNCONFIRM_TITLE"], EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['html'].format(member.name, room_order.room_name, issues_html)) html_body = render_email_template(EMAILS_TEXT["ROOM_UNCONFIRM_TITLE"], EMAILS_TEXT["ROOM_UNCONFIRM_TEXT"]['html'].format(member.name, room_order.room_name, issues_html))
plain_text = MIMEText(plain_body, "plain") plain_text = MIMEText(plain_body, "plain")

7
ext.py
View File

@ -20,6 +20,10 @@ class Order:
self.time = time() self.time = time()
self.data = data self.data = data
if(len(self.data['positions']) == 0):
for fee in data['fees']:
if(fee['fee_type'] == "cancellation"):
self.data['status'] = 'c'
self.status = {'n': 'pending', 'p': 'paid', 'e': 'expired', 'c': 'canceled'}[self.data['status']] self.status = {'n': 'pending', 'p': 'paid', 'e': 'expired', 'c': 'canceled'}[self.data['status']]
self.secret = data['secret'] self.secret = data['secret']
@ -219,7 +223,8 @@ class Order:
# del self.answers[i]['options'] # del self.answers[i]['options']
# del self.answers[i]['option_identifiers'] # del self.answers[i]['option_identifiers']
res = await pretixClient.patch(f'orderpositions/{self.position_id}/', json={'answers': self.answers}, expectedStatusCodes=None) ans = [] if self.status == "canceled" else self.answers
res = await pretixClient.patch(f'orderpositions/{self.position_id}/', json={'answers': ans}, expectedStatusCodes=None)
if res.status_code != 200: if res.status_code != 200:
e = res.json() e = res.json()