stranck-dev #8
10
ext.py
10
ext.py
|
@ -194,10 +194,14 @@ class Order:
|
|||
print("POSITION ID IS", self.position_id)
|
||||
|
||||
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
|
||||
if ans['question'] == 40:
|
||||
del self.answers[i]['options']
|
||||
del self.answers[i]['option_identifiers']
|
||||
#if ans['question'] == 40:
|
||||
# del self.answers[i]['options']
|
||||
# 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})
|
||||
|
||||
|
|
|
@ -68,8 +68,6 @@ async def upload_propic(request, order: Order):
|
|||
|
||||
with open(f"res/propic/{fn}_{order.code}_original.jpg", "wb") as f:
|
||||
f.write(body[0].body)
|
||||
f.flush()
|
||||
f.close()
|
||||
|
||||
aspect_ratio = width/height
|
||||
if aspect_ratio > 1:
|
||||
|
@ -88,8 +86,6 @@ async def upload_propic(request, order: Order):
|
|||
imgBytes = imgBytes.getvalue()
|
||||
with open(f"res/propic/{fn}_{order.code}_{h}.jpg", "wb") as f:
|
||||
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)
|
||||
except Exception:
|
||||
|
|
Loading…
Reference in New Issue