summaryrefslogtreecommitdiff
path: root/ausbutler/interface.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-01-17 01:34:30 +0100
committeremkael <emkael@tlen.pl>2017-01-17 01:34:30 +0100
commit29ec140f34dc5dc609572445a3a19bd5dcaed147 (patch)
treeb4b0a70c180ba3f4fc50ecc49140725ace00fdd1 /ausbutler/interface.py
parent9adc34fa8039d34a6b88e28e7be36feb1f3c93b8 (diff)
Proper links to old butler (normalized or not)
Diffstat (limited to 'ausbutler/interface.py')
-rw-r--r--ausbutler/interface.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/ausbutler/interface.py b/ausbutler/interface.py
index ef0dbd1..bf36c44 100644
--- a/ausbutler/interface.py
+++ b/ausbutler/interface.py
@@ -21,6 +21,7 @@ class Interface(object):
self.translation = Translations()
self.template = Environment(loader=FileSystemLoader('template'))
self.template.filters['translate'] = self.translation.get_translation
+ self.old_butler_normalized = False
def calculate_all(self):
self.init_db()
@@ -44,6 +45,7 @@ class Interface(object):
)
try:
old_normbutler = self.session.execute(old_normbutler_query)
+ self.old_butler_normalized = True
print 'WARNING: Old butler was normalized, but will not be normalized with scores from current tournament'
except ProgrammingError:
print 'WARNING: Old butler was not normalized, will only be used to calculate opponent score'
@@ -83,7 +85,7 @@ class Interface(object):
def __filter_opp_score(self, butler, opp_butler):
if self.config['only_current']:
return opp_butler.match < butler.match or \
- (opp_butler.match == butler.match and \
+ (opp_butler.match == butler.match and
opp_butler.segment <= butler.segment)
else:
return True
@@ -212,7 +214,7 @@ class Interface(object):
segments.append({
'round': 0, 'segment': 0,
'label': Constants.oldbutler,
- 'link': '%sleaderb.html' % old_prefix
+ 'link': ('%snormbutler.html' if self.old_butler_normalized else '%sbutler.html') % old_prefix
})
result_template.append('')
for rnd in range(1, Constants.rnd + 1):