From f4aa5f1fe191c2e3615dc441e5ef13d558338f4d Mon Sep 17 00:00:00 2001 From: Worros Date: Mon, 2 Nov 2009 13:38:36 +0800 Subject: [PATCH 1/2] First fix for sqlite in PlayerStats Fix courtesy of Eleatic Stranger on 2+2 - Page still does not work, need to find an sqlite equivalent to to_char() and variance() --- pyfpdb/SQL.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 3c25963f..2743a407 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -1895,9 +1895,9 @@ class Sql: self.query['playerDetailedStats'] = """ select AS hgametypeid ,gt.base - ,gt.category + ,gt.category AS category ,upper(gt.limitType) AS limittype - ,s.name + ,s.name AS name ,min(gt.bigBlind) AS minbigblind ,max(gt.bigBlind) AS maxbigblind /*, AS gtid*/ @@ -1939,7 +1939,8 @@ class Sql: ,100.0*avg((hp.totalProfit+hp.rake)/(gt.bigBlind+0.0)) AS bb100xr ,avg((hp.totalProfit+hp.rake)/100.0) AS profhndxr ,avg(h.seats+0.0) AS avgseats - ,variance(hp.totalProfit/100.0) AS variance + /*,variance(hp.totalProfit/100.0) AS variance*/ + ,0.0 AS variance from HandsPlayers hp inner join Hands h on (h.id = hp.handId) inner join Gametypes gt on (gt.Id = h.gameTypeId) From 28ca49d592c8e706ad6ee58dd26655bcc33fc5fb Mon Sep 17 00:00:00 2001 From: Worros Date: Mon, 2 Nov 2009 17:23:50 +0800 Subject: [PATCH 2/2] Fix GuiSessionStats.py for sqlite Fix based on solution from Eleatic Stranger on 2+2 --- pyfpdb/GuiSessionViewer.py | 2 ++ pyfpdb/SQL.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pyfpdb/GuiSessionViewer.py b/pyfpdb/GuiSessionViewer.py index 0d391102..79fe3191 100755 --- a/pyfpdb/GuiSessionViewer.py +++ b/pyfpdb/GuiSessionViewer.py @@ -248,6 +248,8 @@ class GuiSessionViewer (threading.Thread): nametest = nametest.replace("L", "") nametest = nametest.replace(",)",")") q = q.replace("", nametest) + q = q.replace("", "%s") + self.db.cursor.execute(q) THRESHOLD = 1800 hands = self.db.cursor.fetchall() diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 2743a407..05edb56a 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -2502,7 +2502,17 @@ class Sql: AND h.handStart ORDER by time""" elif db_server == 'sqlite': - self.query['sessionStats'] = """ """ + self.query['sessionStats'] = """ + SELECT STRFTIME('', h.handStart) as time, hp.handId, hp.startCash, hp.winnings, hp.totalProfit + FROM HandsPlayers hp + INNER JOIN Hands h on (h.id = hp.handId) + INNER JOIN Gametypes gt on (gt.Id = h.gameTypeId) + INNER JOIN Sites s on (s.Id = gt.siteId) + INNER JOIN Players p on (p.Id = hp.playerId) + WHERE hp.playerId in + AND h.handStart + ORDER by time""" + #################################### # Queries to rebuild/modify hudcache