p89 - graph now sorts by siteHandNo rather than handId and takes into account expenditure.

This commit is contained in:
steffen123 2008-09-21 22:21:09 +01:00
parent 8117193b4f
commit 7ed7db3791
3 changed files with 28 additions and 9 deletions

View File

@ -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

View File

@ -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()
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)
#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])
# 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)):

View File

@ -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)