Added fallback handling for transactions with unknown dates.
This commit is contained in:
parent
b55ad25f58
commit
6fcea8e2b3
2 changed files with 5 additions and 1 deletions
|
@ -619,7 +619,9 @@ class MatematDatabase(object):
|
||||||
fromdate, min_id = row
|
fromdate, min_id = row
|
||||||
created: datetime = datetime.fromtimestamp(fromdate)
|
created: datetime = datetime.fromtimestamp(fromdate)
|
||||||
cursor.execute('''
|
cursor.execute('''
|
||||||
SELECT t.ta_id, t.value, t.old_balance, t.date, c.ta_id, d.ta_id, m.ta_id, c.product, m.agent, m.reason
|
SELECT
|
||||||
|
t.ta_id, t.value, t.old_balance, COALESCE(t.date, 0),
|
||||||
|
c.ta_id, d.ta_id, m.ta_id, c.product, m.agent, m.reason
|
||||||
FROM transactions AS t
|
FROM transactions AS t
|
||||||
LEFT JOIN consumptions AS c
|
LEFT JOIN consumptions AS c
|
||||||
ON t.ta_id = c.ta_id
|
ON t.ta_id = c.ta_id
|
||||||
|
|
|
@ -19,6 +19,8 @@ class Transaction:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def receipt_date(self) -> str:
|
def receipt_date(self) -> str:
|
||||||
|
if self.date == datetime.fromtimestamp(0):
|
||||||
|
return '<unknown> '
|
||||||
date: str = self.date.strftime('%d.%m.%Y, %H:%M')
|
date: str = self.date.strftime('%d.%m.%Y, %H:%M')
|
||||||
return date
|
return date
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue