瀏覽代碼

Add oebb specific statement to flattening script

ogert 4 年之前
父節點
當前提交
6a78c171a2
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      cdplib/FlattenData.py

+ 5 - 1
cdplib/FlattenData.py

@@ -133,8 +133,12 @@ class FlattenData():
             key = incoming_key
             if incoming_key is not None:
                 # OEBB SPECIFIC IF STATEMENT
-                if type(data_list[iteration]) is dict and 'stationsnummer' in data_list[iteration].keys() and 'stage' in data_list[iteration].keys() :
+                if type(data_list[iteration]) is dict and 'stationsnummer' in data_list[iteration].keys():
+                        key = incoming_key + '_' + str(data_list[iteration]['stationsnummer'])
+                
+                elif type(data_list[iteration]) is dict and 'stationsnummer' in data_list[iteration].keys() and 'stage' in data_list[iteration].keys() :
                         key = incoming_key + '_' + str(data_list[iteration]['stationsnummer']) + '_' + str(data_list[iteration]['stage'])
+                
                 else:
                     key = incoming_key + '_' + str(iteration)
             else: