summaryrefslogtreecommitdiff
path: root/playoff.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-02-25 18:44:50 +0100
committeremkael <emkael@tlen.pl>2017-02-25 18:44:50 +0100
commit6762fb4bd2b02048a5657b0f2c68b279fdd48176 (patch)
tree9d7ec94e29c61845635af3d8eccc20715d9116c6 /playoff.py
parente0fed55e7bf5b00a85fa0aa4949ba589cf1804d3 (diff)
Towel support
Diffstat (limited to 'playoff.py')
-rw-r--r--playoff.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/playoff.py b/playoff.py
index ec0bb37..6169f5e 100644
--- a/playoff.py
+++ b/playoff.py
@@ -155,13 +155,14 @@ def get_match_info(match):
) if len([team for team in teams if team is not None]) > 0 else ''
try:
+ towels = db_fetch(match['database'], p_sql.TOWEL_COUNT, (match['table'], match['round']))
row = db_fetch(match['database'], p_sql.BOARD_COUNT, (match['table'], match['round']))
if row[1] > 0:
info.running = int(row[1])
- if row[1] == row[0]:
- info.running = 0
- info.winner = info.teams[0].name if info.teams[0].score > info.teams[1].score else info.teams[1].name
- info.loser = info.teams[1].name if info.teams[0].score > info.teams[1].score else info.teams[0].name
+ if row[1] >= row[0] - towels[0]:
+ info.running = 0
+ info.winner = info.teams[0].name if info.teams[0].score > info.teams[1].score else info.teams[1].name
+ info.loser = info.teams[1].name if info.teams[0].score > info.teams[1].score else info.teams[0].name
except Exception as e:
pass
return info