diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index a0b08992..932a08dd 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -120,7 +120,7 @@ class Database: """Get and return the cards for each player in the hand.""" cards = {} # dict of cards, the key is the seat number example: {1: 'AcQd9hTs5d'} c = self.connection.cursor() - c.execute(self.sql.query['get_cards'], hand) + c.execute(self.sql.query['get_cards'], [hand]) colnames = [desc[0] for desc in c.description] for row in c.fetchall(): s_dict = {} @@ -133,7 +133,7 @@ class Database: """Get and return the community cards for the specified hand.""" cards = {} c = self.connection.cursor() - c.execute(self.sql.query['get_common_cards'], hand) + c.execute(self.sql.query['get_common_cards'], [hand]) colnames = [desc[0] for desc in c.description] for row in c.fetchall(): s_dict = {} diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index c9314305..d9904225 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -173,6 +173,8 @@ class Sql: self.query['get_stats_from_hand'] = """ SELECT HudCache.playerId AS player_id, + HandsPlayers.seatNo AS seat, + Players.name AS screen_name, seatNo AS seat, name AS screen_name, sum(HDs) AS n, @@ -237,7 +239,7 @@ class Sql: AND HudCache.gametypeId+0 = Hands.gametypeId+0) INNER JOIN Players ON (Players.id = HandsPlayers.PlayerId+0) WHERE Hands.id = %s - GROUP BY HudCache.PlayerId + GROUP BY HudCache.PlayerId, HandsPlayers.seatNo, Players.name """ # same as above except stats are aggregated for all blind/limit levels diff --git a/pyfpdb/fpdb_simple.py b/pyfpdb/fpdb_simple.py index 73fe06c9..e9093fbc 100644 --- a/pyfpdb/fpdb_simple.py +++ b/pyfpdb/fpdb_simple.py @@ -1411,7 +1411,7 @@ def recognisePlayerIDs(cursor, names, site_id): if len(ids) != len(names): notfound = [n for n in names if n not in ids] # make list of names not in database if notfound: # insert them into database - cursor.executemany("INSERT INTO Players (name, siteId) VALUES (%s, "+str(site_id)+")", (notfound)) + cursor.executemany("INSERT INTO Players (name, siteId) VALUES (%s, "+str(site_id)+")", [[n] for n in notfound]) q2 = "SELECT name,id FROM Players WHERE name=%s" % " OR name=".join(["%s" for n in notfound]) cursor.execute(q2, notfound) # get their new ids tmp = dict(cursor.fetchall())