summaryrefslogtreecommitdiff
path: root/jfr_playoff/sql.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-10-03 16:20:22 +0200
committeremkael <emkael@tlen.pl>2017-10-03 16:20:22 +0200
commit37df04c91788d023681c8a7015b9807764974a1d (patch)
tree0b5c108681b5ea222e2c6d0f7358b372c893f885 /jfr_playoff/sql.py
parent31f3d7ed154c24ffd9c84448effb1d87b7456ade (diff)
Ability to classify teams from specified position according to sepatare tournament results
Diffstat (limited to 'jfr_playoff/sql.py')
-rw-r--r--jfr_playoff/sql.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/jfr_playoff/sql.py b/jfr_playoff/sql.py
index b01bd08..afbfbfb 100644
--- a/jfr_playoff/sql.py
+++ b/jfr_playoff/sql.py
@@ -34,3 +34,19 @@ WHERE #db#.segments.tabl = %s AND #db#.segments.rnd = %s
PREFIX = '''
SELECT shortname FROM #db#.admin
'''
+
+SWISS_ENDED = '''
+SELECT (rnd = roundcnt) AND (segm = segmentsperround) FROM #db#.admin
+'''
+
+SWISS_RESULTS = '''
+SELECT #db#.teams.fullname,
+ SUM(IF(#db#.matches.homet = #db#.teams.id, vph+corrh, vpv+corrv))
+ + #db#.teams.score,
+ #db#.teams.grupa
+FROM #db#.teams
+LEFT JOIN #db#.matches
+ ON (#db#.teams.id = #db#.matches.homet OR #db#.teams.id = #db#.matches.visit)
+WHERE #db#.teams.bye = 0
+GROUP BY #db#.teams.id
+'''