🐛 Fixed export-function

This commit is contained in:
Mawoka
2022-05-08 15:42:41 +02:00
parent bd2ef8c818
commit db9bc40d6f
+2 -2
View File
@@ -31,10 +31,10 @@ async def generate_spreadsheet(quiz_results: dict, quiz: Quiz, with_images: bool
answer_data = quiz_results[str(i)]
worksheet.write(i + 1, 0, question["question"])
worksheet.write(i + 1, 1, question["time"])
if with_images and quiz[i]["image"] != "" or question["image"] is not None:
if with_images and question["image"] != "" or question["image"] is not None:
async with ClientSession() as session, session.get(question["image"]) as response:
img_data = BytesIO(await response.read())
worksheet.insert_image(i + 1, 2, quiz[i]["image"], {"image_data": img_data})
worksheet.insert_image(i + 1, 2, question["image"], {"image_data": img_data})
image = Image.open(img_data)
worksheet.set_row(i + 1, image.height)
worksheet.set_column(2, 2, image.width)