From 6f75719ffe8ce6a48c0ed1d6f0c49d1b400b0b59 Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sun, 27 Sep 2009 02:06:07 +0100 Subject: [PATCH] refine hero's player id derivation in empty db's --- pyfpdb/Database.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 354081f5..7c0add49 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1116,10 +1116,16 @@ class Database: if result: site_id = result[0][0] self.hero[site_id] = self.config.supported_sites[site].screen_name - self.hero_ids[site_id] = self.get_player_id(self.config, site, self.hero[site_id]) + p_id = self.get_player_id(self.config, site, self.hero[site_id]) + if p_id: + self.hero_ids[site_id] = p_id - where = "where hp.playerId not in (-53, " + ", ".join(map(str, self.hero_ids.values())) \ - + ") or h.handStart > '" + start + "'" + print "hero_ids =", self.hero_ids + if self.hero_ids == {}: + where = "" + else: + where = "where hp.playerId not in (-53, " + ", ".join(map(str, self.hero_ids.values())) \ + + ") or h.handStart > '" + start + "'" rebuild_sql = self.sql.query['rebuildHudCache'].replace('', where) self.get_cursor().execute(self.sql.query['clearHudCache'])