diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 685487bc..c0115bd9 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -74,7 +74,7 @@ except ImportError: use_numpy = False -DB_VERSION = 136 +DB_VERSION = 137 # Variance created as sqlite has a bunch of undefined aggregate functions. @@ -147,7 +147,6 @@ class Database: {'tab':'Hands', 'col':'gametypeId', 'drop':0} , {'tab':'HandsPlayers', 'col':'handId', 'drop':0} , {'tab':'HandsPlayers', 'col':'playerId', 'drop':0} - , {'tab':'HandsPlayers', 'col':'tourneyTypeId', 'drop':0} , {'tab':'HandsPlayers', 'col':'tourneysPlayersId', 'drop':0} , {'tab':'HudCache', 'col':'gametypeId', 'drop':1} , {'tab':'HudCache', 'col':'playerId', 'drop':0} @@ -168,7 +167,6 @@ class Database: {'fktab':'Hands', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1} , {'fktab':'HandsPlayers', 'fkcol':'handId', 'rtab':'Hands', 'rcol':'id', 'drop':1} , {'fktab':'HandsPlayers', 'fkcol':'playerId', 'rtab':'Players', 'rcol':'id', 'drop':1} - , {'fktab':'HandsPlayers', 'fkcol':'tourneyTypeId', 'rtab':'TourneyTypes', 'rcol':'id', 'drop':1} , {'fktab':'HandsPlayers', 'fkcol':'tourneysPlayersId','rtab':'TourneysPlayers','rcol':'id', 'drop':1} , {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1} , {'fktab':'HudCache', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1} @@ -1641,7 +1639,6 @@ class Database: pdata[p]['street3Bets'], pdata[p]['street4Bets'], pdata[p]['position'], - pdata[p]['tourneyTypeId'], pdata[p]['tourneysPlayersIds'], pdata[p]['startCards'], pdata[p]['street0_3BChance'], diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 7aab6c98..f0f1f834 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -59,7 +59,6 @@ class DerivedStats(): self.handsplayers[player[1]]['foldSbToStealChance'] = False self.handsplayers[player[1]]['foldedSbToSteal'] = False self.handsplayers[player[1]]['foldedBbToSteal'] = False - self.handsplayers[player[1]]['tourneyTypeId'] = None for i in range(5): self.handsplayers[player[1]]['street%dCalls' % i] = 0 @@ -143,7 +142,6 @@ class DerivedStats(): self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2])) self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection if hand.gametype["type"]=="tour": - self.handsplayers[player[1]]['tourneyTypeId']=hand.tourneyTypeId self.handsplayers[player[1]]['tourneysPlayersIds'] = hand.tourneysPlayersIds[player[1]] else: self.handsplayers[player[1]]['tourneysPlayersIds'] = None diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index ad2b7df0..041ae981 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -560,7 +560,6 @@ class Sql: comment text, commentTs DATETIME, tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id), - tourneyTypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id), wonWhenSeenStreet1 FLOAT, wonWhenSeenStreet2 FLOAT, @@ -677,7 +676,6 @@ class Sql: comment text, commentTs timestamp without time zone, tourneysPlayersId BIGINT, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id), - tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id), wonWhenSeenStreet1 FLOAT, wonWhenSeenStreet2 FLOAT, @@ -793,7 +791,6 @@ class Sql: comment TEXT, commentTs REAL, tourneysPlayersId INT, - tourneyTypeId INT, wonWhenSeenStreet1 REAL, wonWhenSeenStreet2 REAL, @@ -2989,7 +2986,7 @@ class Sql: when hp.position = '9' then 'E' else 'E' end AS hc_position - ,hp.tourneyTypeId + ,t.tourneyTypeId ,date_format(h.startTime, 'd%y%m%d') ,count(1) ,sum(wonWhenSeenStreet1) @@ -3063,12 +3060,14 @@ class Sql: ,sum(hp.street4Raises) FROM HandsPlayers hp INNER JOIN Hands h ON (h.id = hp.handId) + INNER JOIN TourneysPlayers tp ON (tp.id = hp.tourneysPlayersId) + INNER JOIN Tourneys t ON (t.id = tp.tourneyId) GROUP BY h.gametypeId ,hp.playerId ,h.seats ,hc_position - ,hp.tourneyTypeId + ,t.tourneyTypeId ,date_format(h.startTime, 'd%y%m%d') """ elif db_server == 'postgresql': @@ -3168,7 +3167,7 @@ class Sql: when hp.position = '9' then 'E' else 'E' end AS hc_position - ,hp.tourneyTypeId + ,t.tourneyTypeId ,'d' || to_char(h.startTime, 'YYMMDD') ,count(1) ,sum(wonWhenSeenStreet1) @@ -3242,12 +3241,14 @@ class Sql: ,sum(CAST(hp.street4Raises as integer)) FROM HandsPlayers hp INNER JOIN Hands h ON (h.id = hp.handId) + INNER JOIN TourneysPlayers tp ON (tp.id = hp.tourneysPlayersId) + INNER JOIN Tourneys t ON (t.id = tp.tourneyId) GROUP BY h.gametypeId ,hp.playerId ,h.seats ,hc_position - ,hp.tourneyTypeId + ,t.tourneyTypeId ,to_char(h.startTime, 'YYMMDD') """ else: # assume sqlite @@ -3347,7 +3348,7 @@ class Sql: when hp.position = '9' then 'E' else 'E' end AS hc_position - ,hp.tourneyTypeId + ,t.tourneyTypeId ,'d' || substr(strftime('%Y%m%d', h.startTime),3,7) ,count(1) ,sum(wonWhenSeenStreet1) @@ -3421,12 +3422,14 @@ class Sql: ,sum(CAST(hp.street4Raises as integer)) FROM HandsPlayers hp INNER JOIN Hands h ON (h.id = hp.handId) + INNER JOIN TourneysPlayers tp ON (tp.id = hp.tourneysPlayersId) + INNER JOIN Tourneys t ON (t.id = tp.tourneyId) GROUP BY h.gametypeId ,hp.playerId ,h.seats ,hc_position - ,hp.tourneyTypeId + ,t.tourneyTypeId ,'d' || substr(strftime('%Y%m%d', h.startTime),3,7) """ @@ -3858,7 +3861,6 @@ class Sql: street3Bets, street4Bets, position, - tourneyTypeId, tourneysPlayersId, startCards, street0_3BChance, @@ -3917,7 +3919,7 @@ class Sql: %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, - %s, %s + %s )""" ################################