From 7e4e3f8a62e3eac16833449dbebc5250ea930047 Mon Sep 17 00:00:00 2001
From: Andreas Hubel <andi@saerdnaer.de>
Date: Sun, 22 Dec 2024 00:49:01 +0100
Subject: [PATCH] fix(scheduleimport): add changes from review

---
 src/core/models/schedules.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/core/models/schedules.py b/src/core/models/schedules.py
index e2b913666..ca3ad8650 100644
--- a/src/core/models/schedules.py
+++ b/src/core/models/schedules.py
@@ -849,9 +849,10 @@ class ScheduleSourceImport(models.Model):
             )
             self.summary = f"{data.get('version') or ''}\nDONE: {stats}"[:200]
 
-            # disable abort feature, as it hides the actual error messages
-            # if len(errors) > len(activity) / 2:
-            #    raise Exception('Too many errors, aborting import: ' + stats)
+            # add debug option to disable abort feature, as it might hide the actual error messages
+            if len(errors) > len(activity) / 2 and self.import_configuration.get('debug') is not True:
+                self.save(update_fields=['summary'])
+                raise Exception('Too many errors, aborting import: ' + stats)
 
             self.save(update_fields=['data', 'summary'])
 
-- 
GitLab