|
|
@@ -50,7 +50,7 @@ def update_missing_value(maintainer, player, property, value):
|
|
|
conn.commit()
|
|
|
|
|
|
def cron():
|
|
|
- query = """SELECT player_properties.maintainer,
|
|
|
+ query_first = """SELECT player_properties.maintainer,
|
|
|
maintainer.api, player_properties.player,
|
|
|
player_properties.property
|
|
|
FROM player_properties
|
|
|
@@ -59,7 +59,7 @@ def cron():
|
|
|
conn.row_factory = sqlite3.Row
|
|
|
cur = conn.cursor()
|
|
|
|
|
|
- for row in cur.execute(query):
|
|
|
+ for row in cur.execute(query_first):
|
|
|
print(f"{row['maintainer']} - {row['api']} - {row['player']} - {row['property']}")
|
|
|
url = f"https://api.torn.com/user/{row['player']}?selections=personalstats,basic&key={row['api']}"
|
|
|
print(url)
|
|
|
@@ -78,7 +78,7 @@ def cron():
|
|
|
if 'name' not in properties:
|
|
|
properties.append(name)
|
|
|
pprint(properties)
|
|
|
- query_global = """SELECT player.value, properties.parent
|
|
|
+ query_second = """SELECT player.value, properties.parent
|
|
|
FROM player
|
|
|
JOIN properties ON player.property = properties.property
|
|
|
WHERE maintainer = ?
|
|
|
@@ -87,7 +87,7 @@ def cron():
|
|
|
retrieved_properties = []
|
|
|
for property in properties:
|
|
|
pprint((row['maintainer'], row['player'], property,))
|
|
|
- p_rows = cur.execute(query_global, (row['maintainer'], row['player'], property,))
|
|
|
+ p_rows = cur.execute(query_second, (row['maintainer'], row['player'], property,))
|
|
|
for p_row in p_rows:
|
|
|
print(f"property: '{property}' parent: '{p_row['parent']}' -> value: '{p_row['value']}'")
|
|
|
retrieved_properties.append(property)
|
|
|
@@ -106,8 +106,8 @@ def cron():
|
|
|
new_properties.append(item)
|
|
|
if len(new_properties) > 0:
|
|
|
for item in new_properties:
|
|
|
- query = """SELECT parent FROM properties where property = ?;"""
|
|
|
- cur.execute(query, (item,))
|
|
|
+ query_third = """SELECT parent FROM properties where property = ?;"""
|
|
|
+ cur.execute(query_third, (item,))
|
|
|
parent = cur.fetchone()['parent']
|
|
|
if (parent):
|
|
|
value = player_json[parent][item]
|