Filters: Fix date defaults when no hands inserted

This commit is contained in:
Worros 2010-11-10 12:46:48 +08:00
parent 1a96892ec4
commit a4facf0c2a

View File

@ -1060,14 +1060,20 @@ class Filters(threading.Thread):
if t1 == '': if t1 == '':
self.cursor.execute(self.sql.query['get_first_date']) self.cursor.execute(self.sql.query['get_first_date'])
result = self.db.cursor.fetchall() result = self.db.cursor.fetchall()
t1 = result[0][0].split()[0] if result[0][0] == None:
self.start_date.set_text(t1) t1 = '1970-01-02'
else:
t1 = result[0][0].split()[0]
self.start_date.set_text(t1)
if t2 == '': if t2 == '':
self.cursor.execute(self.sql.query['get_last_date']) self.cursor.execute(self.sql.query['get_last_date'])
result = self.db.cursor.fetchall() result = self.db.cursor.fetchall()
t2 = result[0][0].split()[0] if result[0][0] == None:
self.end_date.set_text(t2) t2 = '2020-12-12'
else:
t2 = result[0][0].split()[0]
self.end_date.set_text(t2)
s1 = strptime(t1, "%Y-%m-%d") # make time_struct s1 = strptime(t1, "%Y-%m-%d") # make time_struct
s2 = strptime(t2, "%Y-%m-%d") s2 = strptime(t2, "%Y-%m-%d")