From 8232085be90019752eee7ded6a1a413f57e5d9a1 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 11 Jul 2010 03:42:48 +0200 Subject: [PATCH] display 1st/2nd/3rd in tourney player stats --- pyfpdb/SQL.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 94a2b436..8b608f89 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2259,11 +2259,15 @@ class Sql: if db_server == 'mysql': self.query['tourneyPlayerDetailedStats'] = """ - select t.tourneyTypeId AS tourneyTypeId + select s.name AS siteName + ,t.tourneyTypeId AS tourneyTypeId ,p.name AS playerName - ,s.name AS siteName - ,sum(tp.winnings)/100.0 AS profit - ,sum(tt.buyin+tt.fee)/100.0 AS invested + ,SUM(CASE WHEN rank = 1 THEN 1 ELSE 0 END) AS 1st + ,SUM(CASE WHEN rank = 2 THEN 1 ELSE 0 END) AS 2nd + ,SUM(CASE WHEN rank = 3 THEN 1 ELSE 0 END) AS 3rd + ,SUM(CASE WHEN rank = NULL THEN 1 ELSE 0 END) AS unknownRank + ,SUM(tp.winnings)/100.0 AS profit + ,SUM(tt.buyin+tt.fee)/100.0 AS invested from TourneysPlayers tp inner join Tourneys t on (t.id = tp.tourneyId) inner join TourneyTypes tt on (tt.Id = t.tourneyTypeId)