Fixed a timezone issue in storeSessionsCache

This commit is contained in:
Chaz Littlejohn 2011-03-23 01:22:18 +00:00
parent dd6ce46487
commit 3ac088b748
2 changed files with 5 additions and 1 deletions

View File

@ -2231,6 +2231,10 @@ class Database:
def storeSessionsCache(self, hid, pids, startTime, game, gid, pdata, sc, gsc, tz, heros, doinsert = False): def storeSessionsCache(self, hid, pids, startTime, game, gid, pdata, sc, gsc, tz, heros, doinsert = False):
"""Update cached sessions. If no record exists, do an insert""" """Update cached sessions. If no record exists, do an insert"""
if not tz:
tz_dt = datetime.utcnow() - datetime.today()
tz = tz_dt.seconds/3600
THRESHOLD = timedelta(seconds=int(self.sessionTimeout * 60)) THRESHOLD = timedelta(seconds=int(self.sessionTimeout * 60))
local = startTime + timedelta(hours=int(tz)) local = startTime + timedelta(hours=int(tz))
date = "d%02d%02d%02d" % (local.year - 2000, local.month, local.day) date = "d%02d%02d%02d" % (local.year - 2000, local.month, local.day)

View File

@ -475,7 +475,7 @@ class Importer:
hand = phands[i] hand = phands[i]
try: try:
id = hand.getHandId(self.database, id) id = hand.getHandId(self.database, id)
sc, gsc = hand.updateSessionsCache(self.database, sc, gsc, self.tz, doinsert) sc, gsc = hand.updateSessionsCache(self.database, sc, gsc, None, doinsert)
hbulk = hand.insertHands(self.database, hbulk, doinsert) hbulk = hand.insertHands(self.database, hbulk, doinsert)
hcbulk = hand.updateHudCache(self.database, hcbulk, doinsert) hcbulk = hand.updateHudCache(self.database, hcbulk, doinsert)
ihands.append(hand) ihands.append(hand)