From b32d34a1e2e99051fbd42fa060f6e2d86173c01f Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Fri, 12 Jul 2024 10:18:51 +0200 Subject: [PATCH] fix annotation export for corrupted ones --- teleforma/exam/views.py | 20 ++++++++++++++------ teleforma/models/core.py | 4 ---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/teleforma/exam/views.py b/teleforma/exam/views.py index f59c5426..cb435854 100755 --- a/teleforma/exam/views.py +++ b/teleforma/exam/views.py @@ -211,13 +211,21 @@ class ScriptDownloadView(ScriptMixinView, CourseAccessMixin): if annotation_data.get('type') == 'point': # print(annotation.uuid) # print(uuid) - comment = AnnotationComment.objects.get(annotation_id=annotation.annotation_id, uuid=annotation.uuid) - text = comment.content - bottom_texts.append(text) - # add a number corresponding to the annotation - can.drawString(annotation_data['x'], -12 + height - annotation_data['y'], str(len(bottom_texts))) + comments = AnnotationComment.objects.filter( + annotation_id=annotation.annotation_id, + uuid=annotation.uuid) + if comments: + comment = comments[0] + text = comment.content + bottom_texts.append(text) + # add a number corresponding to the annotation + can.drawString(annotation_data['x'], + -12 + height - annotation_data['y'], + str(len(bottom_texts))) elif annotation_data.get('type') == 'textbox': - can.drawString(annotation_data['x'], -12 + height - annotation_data['y'], annotation_data['content']) + can.drawString(annotation_data['x'], + -12 + height - annotation_data['y'], + annotation_data['content']) can.save() diff --git a/teleforma/models/core.py b/teleforma/models/core.py index 3a3d1092..57b8ee55 100644 --- a/teleforma/models/core.py +++ b/teleforma/models/core.py @@ -67,10 +67,6 @@ import httpx from storages.backends.s3boto3 import S3Boto3Storage -HAS_TELEMETA = False -if 'telemeta' in settings.INSTALLED_APPS: - HAS_TELEMETA = True - app_label = 'teleforma' -- 2.39.5