Bimba.git

commit bc2c2923d1637de121a40430b11851515e23f767

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

converter: fix calculating which timetables are valid

 converter/local/converter.py | 4 +++-


diff --git a/converter/local/converter.py b/converter/local/converter.py
index 8c817c00e9c0a965d79f605e37d95f2f8d3a94fc..842f7e79adce9f07473c6401dd332bb751cf1dff 100755
--- a/converter/local/converter.py
+++ b/converter/local/converter.py
@@ -87,6 +87,7 @@         s, e = name.split('_')
         return s + "{0:03}".format(100 - self.__validity_length(s, e))
 
     def __clean_overlapping(self, names):
+        today = date.today().strftime('%Y%m%d')
         names.sort(key=self.__sort_key)
         print(names)
         if len(names) == 1:
@@ -96,7 +97,8 @@         i = 1
         for name in names[1:]:
             this_start, this_end = name.split('_')
             prev_start, prev_end = names[i-1].split('_')
-            if not (this_start < prev_end or this_start == prev_start):
+            if not ((this_start < prev_end and this_start <= today)
+                    or this_start == prev_start):
                 return_names.append(names[i-1])
 
             i = i + 1