Bimba.git

commit 6a08fe0fc6bad6d8efd2ce4f3ba620d5a43ffd5b

Author: Adam Pioterek <adam.pioterek@protonmail.ch>

converter tidying up

 converter/converter.py | 16 +++++++++++++++-


diff --git a/converter/converter.py b/converter/converter.py
index d5944cf59b07922e436747ce7d6d7a7381439118..c0991ce438383ebef3c1268dfaa855dea03c4cd0 100755
--- a/converter/converter.py
+++ b/converter/converter.py
@@ -123,13 +123,27 @@         names = ['_'.join((row['start'], row['end'])) for row in
                  self.__metadata]
         to_stay = [name for name in names if self.__is_valid(name)
                    or self.__will_valid(name)]
+        print(to_stay)
         to_stay = self.__clean_overlapping(to_stay)
+        print(to_stay)
         to_remove = [name for name in names if name not in to_stay]
         to_remove = [row['id'] for row in self.__metadata
                      if '_'.join((row['start'], row['end'])) in to_remove]
+        print(to_remove)
+        print(self.__metadata)
+
+        new_metadata = []
+        for item in self.__metadata:
+            if item['id'] not in to_remove:
+                new_metadata.append(item)
+
+        self.__metadata = new_metadata
+
+        print(new_metadata)
 
         for name in to_remove:
-            Path('{}.db.gz'.format(name)).unlink
+            print('{}.db.gz'.format(name))
+            Path('{}.db.gz'.format(name)).unlink()
 
 
 class TimetableConverter: