浏览代码

[Debug] Removed another loop

Foppe Hemminga 5 年之前
父节点
当前提交
56b6a4087a
共有 1 个文件被更改,包括 12 次插入13 次删除
  1. 12 13
      cron.py

+ 12 - 13
cron.py

@@ -92,19 +92,18 @@ def cron():
         for property in properties:
             pprint((row['maintainer'], row['player'], property,))
             cur.execute(query_second, (row['maintainer'], row['player'], property,))
-            p_rows = cur.fetchall()
-            for p_row in p_rows:
-                print(f"property: '{property}' parent: '{p_row['parent']}' -> value: '{p_row['value']}'")
-                retrieved_properties.append(property)
-                new_value = ''
-                if (p_row['parent']):
-                    new_value = player_json[p_row['parent']][property]
-                else:
-                    new_value = player_json[property]
-                print(f"p_row['value']: {p_row['value']} != new_value: '{new_value}'")
-                if str(p_row['value']) != str(new_value):
-                    send_notification(row['maintainer'], row['player'], property, p_row['value'], new_value)
-                    update_value(row['maintainer'], row['player'], property, new_value)
+            p_row = cur.fetchone()
+            print(f"property: '{property}' parent: '{p_row['parent']}' -> value: '{p_row['value']}'")
+            retrieved_properties.append(property)
+            new_value = ''
+            if (p_row['parent']):
+                new_value = player_json[p_row['parent']][property]
+            else:
+                new_value = player_json[property]
+            print(f"p_row['value']: {p_row['value']} != new_value: '{new_value}'")
+            if str(p_row['value']) != str(new_value):
+                send_notification(row['maintainer'], row['player'], property, p_row['value'], new_value)
+                update_value(row['maintainer'], row['player'], property, new_value)
         new_properties = []
         print(f"len(properties): {len(properties)}")
         print(f"len(retrieved_properties): {len(retrieved_properties)}")