DB/TOUR: remove HandsPlayers.tourneyTypeId

This commit is contained in:
steffen123 2010-07-22 21:03:01 +02:00
parent b73ee36602
commit ad28168d02
3 changed files with 14 additions and 17 deletions

View File

@ -74,7 +74,7 @@ except ImportError:
use_numpy = False use_numpy = False
DB_VERSION = 136 DB_VERSION = 137
# Variance created as sqlite has a bunch of undefined aggregate functions. # Variance created as sqlite has a bunch of undefined aggregate functions.
@ -147,7 +147,6 @@ class Database:
{'tab':'Hands', 'col':'gametypeId', 'drop':0} {'tab':'Hands', 'col':'gametypeId', 'drop':0}
, {'tab':'HandsPlayers', 'col':'handId', 'drop':0} , {'tab':'HandsPlayers', 'col':'handId', 'drop':0}
, {'tab':'HandsPlayers', 'col':'playerId', 'drop':0} , {'tab':'HandsPlayers', 'col':'playerId', 'drop':0}
, {'tab':'HandsPlayers', 'col':'tourneyTypeId', 'drop':0}
, {'tab':'HandsPlayers', 'col':'tourneysPlayersId', 'drop':0} , {'tab':'HandsPlayers', 'col':'tourneysPlayersId', 'drop':0}
, {'tab':'HudCache', 'col':'gametypeId', 'drop':1} , {'tab':'HudCache', 'col':'gametypeId', 'drop':1}
, {'tab':'HudCache', 'col':'playerId', 'drop':0} , {'tab':'HudCache', 'col':'playerId', 'drop':0}
@ -168,7 +167,6 @@ class Database:
{'fktab':'Hands', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1} {'fktab':'Hands', 'fkcol':'gametypeId', 'rtab':'Gametypes', 'rcol':'id', 'drop':1}
, {'fktab':'HandsPlayers', 'fkcol':'handId', 'rtab':'Hands', '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':'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':'HandsPlayers', 'fkcol':'tourneysPlayersId','rtab':'TourneysPlayers','rcol':'id', 'drop':1}
, {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1} , {'fktab':'HandsActions', 'fkcol':'handsPlayerId', 'rtab':'HandsPlayers', 'rcol':'id', 'drop':1}
, {'fktab':'HudCache', 'fkcol':'gametypeId', 'rtab':'Gametypes', '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]['street3Bets'],
pdata[p]['street4Bets'], pdata[p]['street4Bets'],
pdata[p]['position'], pdata[p]['position'],
pdata[p]['tourneyTypeId'],
pdata[p]['tourneysPlayersIds'], pdata[p]['tourneysPlayersIds'],
pdata[p]['startCards'], pdata[p]['startCards'],
pdata[p]['street0_3BChance'], pdata[p]['street0_3BChance'],

View File

@ -59,7 +59,6 @@ class DerivedStats():
self.handsplayers[player[1]]['foldSbToStealChance'] = False self.handsplayers[player[1]]['foldSbToStealChance'] = False
self.handsplayers[player[1]]['foldedSbToSteal'] = False self.handsplayers[player[1]]['foldedSbToSteal'] = False
self.handsplayers[player[1]]['foldedBbToSteal'] = False self.handsplayers[player[1]]['foldedBbToSteal'] = False
self.handsplayers[player[1]]['tourneyTypeId'] = None
for i in range(5): for i in range(5):
self.handsplayers[player[1]]['street%dCalls' % i] = 0 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]]['startCash'] = int(100 * Decimal(player[2]))
self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection
if hand.gametype["type"]=="tour": if hand.gametype["type"]=="tour":
self.handsplayers[player[1]]['tourneyTypeId']=hand.tourneyTypeId
self.handsplayers[player[1]]['tourneysPlayersIds'] = hand.tourneysPlayersIds[player[1]] self.handsplayers[player[1]]['tourneysPlayersIds'] = hand.tourneysPlayersIds[player[1]]
else: else:
self.handsplayers[player[1]]['tourneysPlayersIds'] = None self.handsplayers[player[1]]['tourneysPlayersIds'] = None

View File

@ -560,7 +560,6 @@ class Sql:
comment text, comment text,
commentTs DATETIME, commentTs DATETIME,
tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id), tourneysPlayersId BIGINT UNSIGNED, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id),
tourneyTypeId SMALLINT UNSIGNED, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
wonWhenSeenStreet1 FLOAT, wonWhenSeenStreet1 FLOAT,
wonWhenSeenStreet2 FLOAT, wonWhenSeenStreet2 FLOAT,
@ -677,7 +676,6 @@ class Sql:
comment text, comment text,
commentTs timestamp without time zone, commentTs timestamp without time zone,
tourneysPlayersId BIGINT, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id), tourneysPlayersId BIGINT, FOREIGN KEY (tourneysPlayersId) REFERENCES TourneysPlayers(id),
tourneyTypeId INT, FOREIGN KEY (tourneyTypeId) REFERENCES TourneyTypes(id),
wonWhenSeenStreet1 FLOAT, wonWhenSeenStreet1 FLOAT,
wonWhenSeenStreet2 FLOAT, wonWhenSeenStreet2 FLOAT,
@ -793,7 +791,6 @@ class Sql:
comment TEXT, comment TEXT,
commentTs REAL, commentTs REAL,
tourneysPlayersId INT, tourneysPlayersId INT,
tourneyTypeId INT,
wonWhenSeenStreet1 REAL, wonWhenSeenStreet1 REAL,
wonWhenSeenStreet2 REAL, wonWhenSeenStreet2 REAL,
@ -2989,7 +2986,7 @@ class Sql:
when hp.position = '9' then 'E' when hp.position = '9' then 'E'
else 'E' else 'E'
end AS hc_position end AS hc_position
,hp.tourneyTypeId ,t.tourneyTypeId
,date_format(h.startTime, 'd%y%m%d') ,date_format(h.startTime, 'd%y%m%d')
,count(1) ,count(1)
,sum(wonWhenSeenStreet1) ,sum(wonWhenSeenStreet1)
@ -3063,12 +3060,14 @@ class Sql:
,sum(hp.street4Raises) ,sum(hp.street4Raises)
FROM HandsPlayers hp FROM HandsPlayers hp
INNER JOIN Hands h ON (h.id = hp.handId) 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)
<where_clause> <where_clause>
GROUP BY h.gametypeId GROUP BY h.gametypeId
,hp.playerId ,hp.playerId
,h.seats ,h.seats
,hc_position ,hc_position
,hp.tourneyTypeId ,t.tourneyTypeId
,date_format(h.startTime, 'd%y%m%d') ,date_format(h.startTime, 'd%y%m%d')
""" """
elif db_server == 'postgresql': elif db_server == 'postgresql':
@ -3168,7 +3167,7 @@ class Sql:
when hp.position = '9' then 'E' when hp.position = '9' then 'E'
else 'E' else 'E'
end AS hc_position end AS hc_position
,hp.tourneyTypeId ,t.tourneyTypeId
,'d' || to_char(h.startTime, 'YYMMDD') ,'d' || to_char(h.startTime, 'YYMMDD')
,count(1) ,count(1)
,sum(wonWhenSeenStreet1) ,sum(wonWhenSeenStreet1)
@ -3242,12 +3241,14 @@ class Sql:
,sum(CAST(hp.street4Raises as integer)) ,sum(CAST(hp.street4Raises as integer))
FROM HandsPlayers hp FROM HandsPlayers hp
INNER JOIN Hands h ON (h.id = hp.handId) 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)
<where_clause> <where_clause>
GROUP BY h.gametypeId GROUP BY h.gametypeId
,hp.playerId ,hp.playerId
,h.seats ,h.seats
,hc_position ,hc_position
,hp.tourneyTypeId ,t.tourneyTypeId
,to_char(h.startTime, 'YYMMDD') ,to_char(h.startTime, 'YYMMDD')
""" """
else: # assume sqlite else: # assume sqlite
@ -3347,7 +3348,7 @@ class Sql:
when hp.position = '9' then 'E' when hp.position = '9' then 'E'
else 'E' else 'E'
end AS hc_position end AS hc_position
,hp.tourneyTypeId ,t.tourneyTypeId
,'d' || substr(strftime('%Y%m%d', h.startTime),3,7) ,'d' || substr(strftime('%Y%m%d', h.startTime),3,7)
,count(1) ,count(1)
,sum(wonWhenSeenStreet1) ,sum(wonWhenSeenStreet1)
@ -3421,12 +3422,14 @@ class Sql:
,sum(CAST(hp.street4Raises as integer)) ,sum(CAST(hp.street4Raises as integer))
FROM HandsPlayers hp FROM HandsPlayers hp
INNER JOIN Hands h ON (h.id = hp.handId) 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)
<where_clause> <where_clause>
GROUP BY h.gametypeId GROUP BY h.gametypeId
,hp.playerId ,hp.playerId
,h.seats ,h.seats
,hc_position ,hc_position
,hp.tourneyTypeId ,t.tourneyTypeId
,'d' || substr(strftime('%Y%m%d', h.startTime),3,7) ,'d' || substr(strftime('%Y%m%d', h.startTime),3,7)
""" """
@ -3858,7 +3861,6 @@ class Sql:
street3Bets, street3Bets,
street4Bets, street4Bets,
position, position,
tourneyTypeId,
tourneysPlayersId, tourneysPlayersId,
startCards, startCards,
street0_3BChance, 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, %s, %s,
%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s %s
)""" )"""
################################ ################################