Prechádzať zdrojové kódy

[Bugfix] Fix missing properties

Foppe Hemminga 5 rokov pred
rodič
commit
4cca03b0b9
1 zmenil súbory, kde vykonal 6 pridanie a 6 odobranie
  1. 6 6
      cron.py

+ 6 - 6
cron.py

@@ -118,18 +118,18 @@ def cron():
         if len(new_properties) > 0:
             print(f"len(new_properties): {len(new_properties)}")
             for item in new_properties:
-                if item == 'tokenrefills':
-                    # Weird error
-                    continue
-                if item == 'incendiaryammoused':
-                    continue
                 query_third = """SELECT parent FROM properties where property = ?;"""
                 cur.execute(query_third, (item,))
                 parent = cur.fetchone()['parent']
                 if (parent):
                     value = player_json[parent][item]
                 else:
-                    value = player_json[item]
+                    try:
+                        value = player_json[item]
+                    except KeyError:
+                        query_fourth = """INSERT INTO properties (property, parent)
+                            VALUES (?, 'personalstats')"""
+                         cur.execute(query_fourth, (item,))
                 print(f"item: {item} -> value: {value}")
                 update_missing_value(row['maintainer'], row['player'], item, value)
         time.sleep(1)