diff options
author | emkael <emkael@tlen.pl> | 2017-09-08 01:28:21 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-09-08 01:28:21 +0200 |
commit | 8f795b1d445441daab5ffb75060a6dbf8ed0934a (patch) | |
tree | 15e55a2a7e03867ac0cccfb8303674d478510503 /scripts/generate-json.py | |
parent | 655a9847513332e8e119f37f7ed95f4ab002b1a1 (diff) |
Renaming scripts so that their names make sense
Diffstat (limited to 'scripts/generate-json.py')
-rw-r--r-- | scripts/generate-json.py | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/scripts/generate-json.py b/scripts/generate-json.py deleted file mode 100644 index 54bb26d..0000000 --- a/scripts/generate-json.py +++ /dev/null @@ -1,31 +0,0 @@ -import json, sys -from pyranking.db import cursor - -date = sys.argv[1] - -sql = '''SELECT - rankings.place, - players.id, - players.rank, - rankings.score -FROM players -LEFT JOIN rankings - ON players.id = rankings.pid - AND rankings.date = %(date)s -''' -cursor.execute(sql, {'date': date}) - -result = {} -for row in cursor.fetchall(): - if row['place'] is not None: - result[row['id']] = { - 'place': int(row['place']), - 'rank': float(row['rank']), - 'score': float(row['score']) - } - else: - result[row['id']] = { - 'rank': float(row['rank']) - } - -print json.dumps(result) |