Import Hand.insert() work
storeHand updated, almost works, just violating some NOT NULL contraints
This commit is contained in:
		
							parent
							
								
									a24fe93612
								
							
						
					
					
						commit
						d6529ab42f
					
				| 
						 | 
					@ -28,6 +28,7 @@ import sys
 | 
				
			||||||
import traceback
 | 
					import traceback
 | 
				
			||||||
from datetime import datetime, date, time, timedelta
 | 
					from datetime import datetime, date, time, timedelta
 | 
				
			||||||
from time import time, strftime, sleep
 | 
					from time import time, strftime, sleep
 | 
				
			||||||
 | 
					from decimal import Decimal
 | 
				
			||||||
import string
 | 
					import string
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
| 
						 | 
					@ -1127,6 +1128,7 @@ class Database:
 | 
				
			||||||
            sitehandno,
 | 
					            sitehandno,
 | 
				
			||||||
            handstart, 
 | 
					            handstart, 
 | 
				
			||||||
            importtime,
 | 
					            importtime,
 | 
				
			||||||
 | 
					            seats,
 | 
				
			||||||
            maxseats,
 | 
					            maxseats,
 | 
				
			||||||
            boardcard1, 
 | 
					            boardcard1, 
 | 
				
			||||||
            boardcard2, 
 | 
					            boardcard2, 
 | 
				
			||||||
| 
						 | 
					@ -1135,7 +1137,8 @@ class Database:
 | 
				
			||||||
            boardcard5
 | 
					            boardcard5
 | 
				
			||||||
             ) 
 | 
					             ) 
 | 
				
			||||||
             VALUES 
 | 
					             VALUES 
 | 
				
			||||||
              (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
 | 
					              (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
 | 
				
			||||||
 | 
					                %s, %s)"""
 | 
				
			||||||
#---            texture,
 | 
					#---            texture,
 | 
				
			||||||
#--            playersVpi,
 | 
					#--            playersVpi,
 | 
				
			||||||
#--            playersAtStreet1, 
 | 
					#--            playersAtStreet1, 
 | 
				
			||||||
| 
						 | 
					@ -1156,14 +1159,17 @@ class Database:
 | 
				
			||||||
#--            seats, 
 | 
					#--            seats, 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        q = q.replace('%s', self.sql.query['placeholder'])
 | 
					        q = q.replace('%s', self.sql.query['placeholder'])
 | 
				
			||||||
 | 
					        print "DEBUG: p: %s" %p
 | 
				
			||||||
 | 
					        print "DEBUG: gtid: %s" % p['gameTypeId']
 | 
				
			||||||
        self.cursor.execute(q, (
 | 
					        self.cursor.execute(q, (
 | 
				
			||||||
                p['tableName'], 
 | 
					                p['tableName'], 
 | 
				
			||||||
 | 
					                p['gameTypeId'], 
 | 
				
			||||||
                p['siteHandNo'], 
 | 
					                p['siteHandNo'], 
 | 
				
			||||||
                p['gametypeid'], 
 | 
					 | 
				
			||||||
                p['handStart'], 
 | 
					                p['handStart'], 
 | 
				
			||||||
                datetime.today(), #importtime
 | 
					                datetime.today(), #importtime
 | 
				
			||||||
#                len(p['names']), #seats
 | 
					#                len(p['names']), #seats
 | 
				
			||||||
                p['maxSeats'],
 | 
					                p['maxSeats'],
 | 
				
			||||||
 | 
					                p['seats'],
 | 
				
			||||||
                p['boardcard1'], 
 | 
					                p['boardcard1'], 
 | 
				
			||||||
                p['boardcard2'], 
 | 
					                p['boardcard2'], 
 | 
				
			||||||
                p['boardcard3'], 
 | 
					                p['boardcard3'], 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -197,10 +197,10 @@ db: a connected fpdb_db object"""
 | 
				
			||||||
            hilo = "s"
 | 
					            hilo = "s"
 | 
				
			||||||
        elif self.gametype['category'] in ['razz','27_3draw','badugi']:
 | 
					        elif self.gametype['category'] in ['razz','27_3draw','badugi']:
 | 
				
			||||||
            hilo = "l"
 | 
					            hilo = "l"
 | 
				
			||||||
        #FIXME - the two zeros are small_bet and big_bet for limit
 | 
					
 | 
				
			||||||
        gtid = db.insertGameTypes( (self.siteId, self.gametype['type'], self.gametype['base'], 
 | 
					        gtid = db.insertGameTypes( (self.siteId, self.gametype['type'], self.gametype['base'], 
 | 
				
			||||||
                                    self.gametype['category'], self.gametype['limitType'], hilo,
 | 
					                                    self.gametype['category'], self.gametype['limitType'], hilo,
 | 
				
			||||||
                                    self.gametype['sb'], self.gametype['bb'], 0, 0) )
 | 
					                                    int(Decimal(self.gametype['sb'])*100), int(Decimal(self.gametype['bb'])*100), 0, 0) )
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # HudCache data to come from DerivedStats class
 | 
					        # HudCache data to come from DerivedStats class
 | 
				
			||||||
| 
						 | 
					@ -210,9 +210,11 @@ db: a connected fpdb_db object"""
 | 
				
			||||||
        hh = {}
 | 
					        hh = {}
 | 
				
			||||||
        hh['siteHandNo'] =  self.handid
 | 
					        hh['siteHandNo'] =  self.handid
 | 
				
			||||||
        hh['handStart'] = self.starttime
 | 
					        hh['handStart'] = self.starttime
 | 
				
			||||||
 | 
					        hh['gameTypeId'] = gtid[0]
 | 
				
			||||||
        # seats TINYINT NOT NULL,
 | 
					        # seats TINYINT NOT NULL,
 | 
				
			||||||
        hh['tableName'] = self.tablename
 | 
					        hh['tableName'] = self.tablename
 | 
				
			||||||
        hh['maxSeats'] = self.maxseats
 | 
					        hh['maxSeats'] = self.maxseats
 | 
				
			||||||
 | 
					        hh['seats'] = len(sqlids)
 | 
				
			||||||
             # boardcard1 smallint,  /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
 | 
					             # boardcard1 smallint,  /* 0=none, 1-13=2-Ah 14-26=2-Ad 27-39=2-Ac 40-52=2-As */
 | 
				
			||||||
             # boardcard2 smallint,
 | 
					             # boardcard2 smallint,
 | 
				
			||||||
             # boardcard3 smallint,
 | 
					             # boardcard3 smallint,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user