Fixed problem with unreliable fav_seat placement.

Eliminated special query to get actual seat by
incorporating in to stat_dict query. Provided for
graceful skipping of hands when there is an error
in a query in the read_stdin() thread. Left
intermediate prints for use of others.
This commit is contained in:
Ray
2009-02-23 21:33:23 -05:00
parent 2ebb026543
commit f1530860d2
4 changed files with 38 additions and 30 deletions
+3 -14
View File
@@ -165,19 +165,11 @@ class Database:
c = self.connection.cursor()
if aggregate:
query = 'get_stats_from_hand'
subs = (hand, hand)
else:
query = 'get_stats_from_hand_aggregated'
subs = (hand, hand, hand)
# get the players in the hand and their seats
c.execute(self.sql.query['get_players_from_hand'], (hand, ))
names = {}
seats = {}
for row in c.fetchall():
names[row[0]] = row[2]
seats[row[0]] = row[1]
else:
query = 'get_stats_from_hand'
subs = (hand, hand)
# now get the stats
c.execute(self.sql.query[query], subs)
@@ -187,9 +179,6 @@ class Database:
t_dict = {}
for name, val in zip(colnames, row):
t_dict[name] = val
# print t_dict
t_dict['screen_name'] = names[t_dict['player_id']]
t_dict['seat'] = seats[t_dict['player_id']]
stat_dict[t_dict['player_id']] = t_dict
return stat_dict