From ed096b68723c13b6d2f90012ad115a8a6bc9c3fb Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 11 Jul 2010 05:22:36 +0200 Subject: [PATCH] TPS displays ROI% --- pyfpdb/GuiTourneyPlayerStats.py | 8 ++++---- pyfpdb/SQL.py | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pyfpdb/GuiTourneyPlayerStats.py b/pyfpdb/GuiTourneyPlayerStats.py index ab654b79..105ed880 100644 --- a/pyfpdb/GuiTourneyPlayerStats.py +++ b/pyfpdb/GuiTourneyPlayerStats.py @@ -85,10 +85,10 @@ class GuiTourneyPlayerStats (threading.Thread): , ["2nd", True, "2nd", 1.0, "%1.0f", "str"] , ["3rd", True, "3rd", 1.0, "%1.0f", "str"] , ["unknownRank", True, "unknown", 1.0, "%1.0f", "str"] - #, ["roi", True, "ROI", 1.0, "%3.1f", "str"] - , ["invested", True, "Invested", 1.0, "%3.2f", "str"] - , ["profit", True, "Profit", 1.0, "%3.2f", "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"]] + self.stats_frame = gtk.Frame() self.stats_frame.show() diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 2d27ee45..9f9747b8 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2269,8 +2269,9 @@ class Sql: ,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(tp.winnings)/100.0 AS profit - ,SUM(tt.buyin+tt.fee)/100.0 AS invested + ,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 from TourneysPlayers tp inner join Tourneys t on (t.id = tp.tourneyId) inner join TourneyTypes tt on (tt.Id = t.tourneyTypeId)