summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-09-07 02:16:57 +0200
committeremkael <emkael@tlen.pl>2017-09-07 02:16:57 +0200
commitb011fb2daa0f6b8591cbc495ec069b50ff337204 (patch)
treefa121163d993dc6b02d848c495d51458b689c354
parent46443146f51a3b788c28b4ac4b9b8de7b22af39f (diff)
Page size as a parameter in players page script
-rw-r--r--scripts/players.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/players.py b/scripts/players.py
index 22a1321..7799972 100644
--- a/scripts/players.py
+++ b/scripts/players.py
@@ -4,6 +4,7 @@ from math import ceil
from pyranking.fetch import fetch_ranking
output_directory = sys.argv[1]
+pagesize = 100.0
dates = {}
for date_config in json.load(file('config/dates.json')):
@@ -61,9 +62,9 @@ for pid, player in players.iteritems():
rank_link = row.find('td').a
rank_link.string = '.'.join(date.split('-')[::-1])
base_rank_link = '../%s' % (dates[date])
- if ranking is not None and ranking['place'] > 100:
+ if ranking is not None and ranking['place'] > int(pagesize):
rank_link['href'] = '../%s#page:%d' % (
- dates[date], ceil(ranking['place'] / 100.0)
+ dates[date], ceil(ranking['place'] / pagesize)
)
else:
rank_link['href'] = base_rank_link
@@ -73,9 +74,9 @@ for pid, player in players.iteritems():
score_cell['title'] = str(ranking['score'])
for field in ['region', 'age', 'gender']:
link = row.select('td.'+field+' a')[0]
- if ranking[field+'-place'] > 100:
+ if ranking[field+'-place'] > int(pagesize):
link['href'] = base_rank_link + '#%s:%s;page:%d' % (
- field, ranking[field], ceil(ranking[field+'-place'] / 100.0)
+ field, ranking[field], ceil(ranking[field+'-place'] / pagesize)
)
else:
link['href'] = base_rank_link + '#%s:%s' % (