Updated init_hud_stat_vars() so that it no longer requires Filters.py for the offset calculations
This commit is contained in:
parent
9098c3ba03
commit
c6802484cb
|
@ -55,7 +55,6 @@ import Card
|
||||||
import Charset
|
import Charset
|
||||||
from Exceptions import *
|
from Exceptions import *
|
||||||
import Configuration
|
import Configuration
|
||||||
import Filters
|
|
||||||
|
|
||||||
|
|
||||||
# Other library modules
|
# Other library modules
|
||||||
|
@ -256,6 +255,11 @@ class Database:
|
||||||
self.database = db_params['db-databaseName']
|
self.database = db_params['db-databaseName']
|
||||||
self.host = db_params['db-host']
|
self.host = db_params['db-host']
|
||||||
self.db_path = ''
|
self.db_path = ''
|
||||||
|
gen = c.get_general_params()
|
||||||
|
self.day_start = 0
|
||||||
|
|
||||||
|
if 'day_start' in gen:
|
||||||
|
self.day_start = float(gen['day_start'])
|
||||||
|
|
||||||
# where possible avoid creating new SQL instance by using the global one passed in
|
# where possible avoid creating new SQL instance by using the global one passed in
|
||||||
if sql is None:
|
if sql is None:
|
||||||
|
@ -691,15 +695,17 @@ class Database:
|
||||||
if row and row[0]:
|
if row and row[0]:
|
||||||
self.hand_1day_ago = int(row[0])
|
self.hand_1day_ago = int(row[0])
|
||||||
|
|
||||||
offset = strptime(Filters.Filters(self, self.config, self.sql).getDates()[0],"%Y-%m-%d %H:%M:%S").tm_hour
|
tz = datetime.utcnow() - datetime.today()
|
||||||
|
tz_offset = tz.seconds/3600
|
||||||
|
tz_day_start_offset = self.day_start + tz_offset
|
||||||
|
|
||||||
d = timedelta(days=hud_days, hours=offset)
|
d = timedelta(days=hud_days, hours=tz_day_start_offset)
|
||||||
now = datetime.utcnow() - d
|
now = datetime.utcnow() - d
|
||||||
self.date_ndays_ago = "d%02d%02d%02d%02d" % (now.year - 2000, now.month, now.day, offset)
|
self.date_ndays_ago = "d%02d%02d%02d%02d" % (now.year - 2000, now.month, now.day, tz_day_start_offset)
|
||||||
|
|
||||||
d = timedelta(days=h_hud_days, hours=offset)
|
d = timedelta(days=h_hud_days, hours=tz_day_start_offset)
|
||||||
now = datetime.utcnow() - d
|
now = datetime.utcnow() - d
|
||||||
self.h_date_ndays_ago = "d%02d%02d%02d%02d" % (now.year - 2000, now.month, now.day, offset)
|
self.h_date_ndays_ago = "d%02d%02d%02d%02d" % (now.year - 2000, now.month, now.day, tz_day_start_offset)
|
||||||
|
|
||||||
def init_player_hud_stat_vars(self, playerid):
|
def init_player_hud_stat_vars(self, playerid):
|
||||||
# not sure if this is workable, to be continued ...
|
# not sure if this is workable, to be continued ...
|
||||||
|
|
Loading…
Reference in New Issue
Block a user