diff options
author | lassulus <lassulus@lassul.us> | 2018-09-18 19:01:36 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2018-09-18 19:01:36 +0200 |
commit | 2dfb816ddadb34e5b11676ef18c3c2f9079c8146 (patch) | |
tree | 59658869371ec5ac11fcd749cf270e1be655d1f5 /titlebot/commands/highest | |
parent | 00b26ca0bb45d0fb7989a3ddf506bd8230363a14 (diff) |
throw away dead code
Diffstat (limited to 'titlebot/commands/highest')
-rwxr-xr-x | titlebot/commands/highest | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/titlebot/commands/highest b/titlebot/commands/highest deleted file mode 100755 index d0408ac..0000000 --- a/titlebot/commands/highest +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python3 -import json -from os import environ -import sys -import os -import poll - -f = 'suggestions.json' -title=" ".join(sys.argv[1:]) -db = poll.load_db(f) -# only print the last N values (default 1) -limit = int(sys.argv[1]) if len(sys.argv) > 1 else 1 -num = 0 -last_vote = 9001 -# stolen from http://stackoverflow.com/questions/9647202/ordinal-numbers-replacement -suffixes = ["th", "st", "nd", "rd", ] + ["th"] * 16 - -for entry in poll.sort_by_votes(db): - # if two entries have the same number of upvotes, do not increment the rank - current_vote = sum(entry['votes'].values()) - if current_vote < last_vote: - num = num + 1 - last_vote = current_vote - # exit if we are above the limit - if num > limit: - sys.exit(0) - - suffixed_num = str(num) + suffixes[num % 100] - print("%s: '%s' (%d votes)" % - (suffixed_num,entry['title'],sum(entry['votes'].values()))) |