Compare commits
2 Commits
c7159cf3b4
...
76c8df9e03
Author | SHA1 | Date |
---|---|---|
stranck | 76c8df9e03 | |
Andrea | 823aaf4f13 |
10
ext.py
10
ext.py
|
@ -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})
|
||||||
|
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue