]> git.parisson.com Git - teleforma.git/commitdiff
fix annotation export for corrupted ones
authorGuillaume Pellerin <guillaume.pellerin@free.fr>
Fri, 12 Jul 2024 08:18:51 +0000 (10:18 +0200)
committerGuillaume Pellerin <guillaume.pellerin@free.fr>
Fri, 12 Jul 2024 08:18:51 +0000 (10:18 +0200)
teleforma/exam/views.py
teleforma/models/core.py

index f59c5426e6b94c1eec549b1fa3c7a63dac901b79..cb435854945eff22d121cc731a00f4e55e82a9b0 100755 (executable)
@@ -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()
 
index 3a3d10925bc71527cf27154621644f935a6a311a..57b8ee551ce0b47b8d5ea6b54200c0b42ba53be9 100644 (file)
@@ -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'