From 6038342de736d9e4f93462aaf10c4ec3a99a2537 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 11 Jul 2010 05:35:41 +0200 Subject: [PATCH] TPS displays profit/tourney --- pyfpdb/GuiTourneyPlayerStats.py | 3 ++- pyfpdb/SQL.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyfpdb/GuiTourneyPlayerStats.py b/pyfpdb/GuiTourneyPlayerStats.py index e3ce2691..2d901c94 100644 --- a/pyfpdb/GuiTourneyPlayerStats.py +++ b/pyfpdb/GuiTourneyPlayerStats.py @@ -89,7 +89,8 @@ class GuiTourneyPlayerStats (threading.Thread): , ["unknownRank", True, "Rank?", 1.0, "%1.0f", "str"] , ["spent", True, "Spent", 1.0, "%3.2f", "str"] , ["won", True, "Won", 1.0, "%3.2f", "str"] - , ["roi", True, "ROI%", 1.0, "%3.0f", "str"]] + , ["roi", True, "ROI%", 1.0, "%3.0f", "str"] + , ["profitPerTourney", True,"$/Tour", 1.0, "%3.2f", "str"]] self.stats_frame = gtk.Frame() self.stats_frame.show() diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 0588f2de..77a3883c 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2273,7 +2273,8 @@ class Sql: ,SUM(CASE WHEN rank = 3 THEN 1 ELSE 0 END) AS 3rd ,SUM(tp.winnings)/100.0 AS won ,SUM(tt.buyin+tt.fee)/100.0 AS spent - ,SUM(tp.winnings)/SUM(tt.buyin+tt.fee)*100.0-100 AS roi + ,SUM(tp.winnings)/SUM(tt.buyin+tt.fee)*100.0-100 AS roi + ,SUM(tp.winnings-(tt.buyin+tt.fee))/100.0/(COUNT(1)-SUM(CASE WHEN tp.rank > 0 THEN 0 ELSE 1 END)) AS profitPerTourney from TourneysPlayers tp inner join Tourneys t on (t.id = tp.tourneyId) inner join TourneyTypes tt on (tt.Id = t.tourneyTypeId)