stranck-dev #8

Merged
drew merged 6 commits from stranck-dev into drew-dev 2024-01-08 23:09:45 +00:00
2 changed files with 7 additions and 7 deletions
Showing only changes of commit 76c8df9e03 - Show all commits

10
ext.py
View File

@ -194,10 +194,14 @@ class Order:
print("POSITION ID IS", self.position_id) print("POSITION ID IS", self.position_id)
for i, ans in enumerate(self.answers): for i, ans in enumerate(self.answers):
if TYPE_OF_QUESTIONS[ans['question']] == QUESTION_TYPES["multiple_choice_from_list"]: # if multiple choice
identifier = ans['question_identifier']
if self.ans(identifier) == "": #if empty answer
await self.edit_answer(identifier, None)
# Fix for karaoke fields # Fix for karaoke fields
if ans['question'] == 40: #if ans['question'] == 40:
del self.answers[i]['options'] # del self.answers[i]['options']
del self.answers[i]['option_identifiers'] # del self.answers[i]['option_identifiers']
res = await client.patch(join(base_url_event, f'orderpositions/{self.position_id}/'), headers=headers, json={'answers': self.answers}) res = await client.patch(join(base_url_event, f'orderpositions/{self.position_id}/'), headers=headers, json={'answers': self.answers})

View File

@ -68,8 +68,6 @@ async def upload_propic(request, order: Order):
with open(f"res/propic/{fn}_{order.code}_original.jpg", "wb") as f: with open(f"res/propic/{fn}_{order.code}_original.jpg", "wb") as f:
f.write(body[0].body) f.write(body[0].body)
f.flush()
f.close()
aspect_ratio = width/height aspect_ratio = width/height
if aspect_ratio > 1: if aspect_ratio > 1:
@ -88,8 +86,6 @@ async def upload_propic(request, order: Order):
imgBytes = imgBytes.getvalue() imgBytes = imgBytes.getvalue()
with open(f"res/propic/{fn}_{order.code}_{h}.jpg", "wb") as f: with open(f"res/propic/{fn}_{order.code}_{h}.jpg", "wb") as f:
f.write(imgBytes) f.write(imgBytes)
f.flush()
f.close()
await order.edit_answer_fileUpload(f'{fn}_file', f'{fn}_file_{order.code}_{h}.jpg', 'image/jpeg', imgBytes) await order.edit_answer_fileUpload(f'{fn}_file', f'{fn}_file_{order.code}_{h}.jpg', 'image/jpeg', imgBytes)
except Exception: except Exception: