Jelajahi Sumber

适配postgresql, 优化算法

jxing 5 tahun lalu
induk
melakukan
69e1299050
1 mengubah file dengan 5 tambahan dan 3 penghapusan
  1. 5 3
      src/grid/check_grid.py

+ 5 - 3
src/grid/check_grid.py

@@ -7,8 +7,8 @@ def check_grid_upright(model_list, grid_data_dict):
     for model_id, all_grid in grid_data_dict.items():
         name_dict = dict()
         for data_row in all_grid:
-            # name_dict[data_row.get('name')] = str(data_row.get('location')).replace('\'', '"')
-            name_dict[data_row.get('name')] = data_row.get('location')
+            name_dict[data_row.get('name')] = str(data_row.get('location')).replace('\'', '"')
+            # name_dict[data_row.get('name')] = data_row.get('location')
         calc_dict[model_id] = name_dict
     for model_id, name_location_dict in calc_dict.items():
         # 判断并插入分组
@@ -29,7 +29,7 @@ def check_grid_upright(model_list, grid_data_dict):
     return True
 
 # def process_location(grids):
-#     for name, location in grids.
+#     for name, location in grids.items()
 
 def insert_group(group, model_id, calc_dict):
     # 如果第一次往group里添加元素, 直接添加
@@ -61,11 +61,13 @@ def has_conflict(base, compare):
     for name, location in base.items():
         if isinstance(location, str):
             location = json.loads(location)
+            base[name] = location
         if name in compare:
             type1 = location.get('Type')
             location2 = compare.get(name)
             if isinstance(location2, str):
                 location2 = json.loads(location2)
+                compare[name] = location2
             type2 = location2.get('Type')
             if type1 in type2:
                 if 'Line' in type1: