diff options
author | SoniEx2 <endermoneymod@gmail.com> | 2019-04-19 16:42:59 -0300 |
---|---|---|
committer | SoniEx2 <endermoneymod@gmail.com> | 2019-04-19 16:42:59 -0300 |
commit | ef608985145e905354e011fba1897301c1c932e8 (patch) | |
tree | 5bd8d15b794df4eecda5847091e010bd1cda49f3 | |
parent | 9b983f9862ac336340803d0870a05a1ed93914ee (diff) |
Tweak sorting
-rwxr-xr-x | ganarchy.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ganarchy.py b/ganarchy.py index ed48538..22695ba 100755 --- a/ganarchy.py +++ b/ganarchy.py @@ -203,9 +203,11 @@ def cron_target(): count, post_hash, msg = result entries.append((url, count, post_hash)) generate_html.append((url, msg, count)) + # sort stuff twice because reasons + entries.sort(key=lambda x: x[1], reverse=True) + generate_html.sort(key=lambda x: x[2], reverse=True) c.executemany('''INSERT INTO repo_history VALUES (NULL, ?, ?, ?)''', entries) conn.commit() - generate_html.sort(key=lambda x: x[2]) # sort by count html_entries = [] for (url, msg, count) in generate_html: history = c.execute('''SELECT count FROM repo_history WHERE url == ? ORDER BY entry ASC''', (url,)).fetchall() |