From 7ed7db3791d5b61ae68c6357478aa5efd60d0ee2 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 21 Sep 2008 22:21:09 +0100 Subject: [PATCH] p89 - graph now sorts by siteHandNo rather than handId and takes into account expenditure. --- docs/known-bugs-and-planned-features.txt | 3 ++- pyfpdb/GuiGraphViewer.py | 32 ++++++++++++++++++------ pyfpdb/fpdb.py | 2 +- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/docs/known-bugs-and-planned-features.txt b/docs/known-bugs-and-planned-features.txt index 3ee7d983..4ccb14f8 100644 --- a/docs/known-bugs-and-planned-features.txt +++ b/docs/known-bugs-and-planned-features.txt @@ -3,7 +3,8 @@ Please also see db-todo.txt alpha4 (release 25Sep-2Oct) ====== -graph: using the wrong table fields, update dependencies.txt, select site from drop down +graph: update dependencies.txt, select site from drop down +print a "press any key" thing after we print the traceback. That way it is easy for them to see the error message. check we're reading mucked cards from PS newsletter&mailing list update requirements to include new pgsql interface lib diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index bf46c17d..5880fb70 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -46,14 +46,32 @@ class GuiGraphViewer (threading.Thread): # x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # y = [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0] - #self.db.reconnect() + self.cursor.execute("""SELECT handId, winnings FROM HandsPlayers + INNER JOIN Players ON HandsPlayers.playerId = Players.id + INNER JOIN Hands ON Hands.id = HandsPlayers.handId + WHERE Players.name = %s ORDER BY siteHandNo""", (name, )) + winnings = self.db.cursor.fetchall() + + + + + #print "winnings:",winnings + #print "" + #print "spent:",spent + + profit=range(len(winnings)) + for i in profit: + self.cursor.execute("""SELECT SUM(amount) FROM HandsActions + INNER JOIN HandsPlayers ON HandsActions.handPlayerId = HandsPlayers.id + INNER JOIN Players ON HandsPlayers.playerId = Players.id + WHERE Players.name = %s AND HandsPlayers.handId = %s""", (name, winnings[i][0])) + spent = self.db.cursor.fetchone() + + profit[i]=(i, winnings[i][1]-spent[0]) + - self.cursor.execute("SELECT handId, winnings FROM HandsPlayers INNER JOIN Players ON HandsPlayers.playerId = Players.id WHERE Players.name = %s ORDER BY handId", (name, )) - - self.results = self.db.cursor.fetchall() - -# x=map(lambda x:float(x[0]),self.results) - y=map(lambda x:float(x[1]),self.results) +# x=map(lambda x:float(x[0]), results) + y=map(lambda x:float(x[1]), profit) line = range(len(y)) for i in range(len(y)): diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 42c653a5..dce926fa 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -417,7 +417,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) - self.window.set_title("Free Poker DB - version: alpha4+, p88 or higher") + self.window.set_title("Free Poker DB - version: alpha4+, p89 or higher") self.window.set_border_width(1) self.window.set_size_request(1020,400) self.window.set_resizable(True)