uncommitted changes, thank you very much

This commit is contained in:
Kasownik 2023-04-07 22:24:09 +02:00
parent 3fc309b55f
commit d2e9d16c7b
3 changed files with 16 additions and 14 deletions

View file

@ -124,17 +124,6 @@ class CAMT052Parser:
amt = entry.find("ns:Amt", ns)
transfer = RawTransfer()
transfer.index = 1
transfer.uid = txdtls.find("ns:Refs", ns).find("ns:TxId", ns).text
transfer.on_account = on_account
transfer.raw = ET.tostring(entry).decode()
transfer.amount = int(Decimal(amt.text) * 100)
transfer.currency = amt.attrib["Ccy"]
transfer.date = datetime.datetime.strptime(
entry.find("ns:BookgDt", ns).find("ns:DtTm", ns).text,
"%Y-%m-%dT%H:%M:%S",
).date()
transfer.title = txdtls.find("ns:RmtInf", ns).find("ns:Ustrd", ns).text
if tx_type == "DBIT":
transfer.to_account = (
@ -163,6 +152,18 @@ class CAMT052Parser:
else:
transfer.type = "IN"
transfer.index = 1
transfer.uid = txdtls.find("ns:Refs", ns).find("ns:InstrId", ns).text + '.' + transfer.type
transfer.on_account = on_account
transfer.raw = ET.tostring(entry).decode()
transfer.amount = int(Decimal(amt.text) * 100)
transfer.currency = amt.attrib["Ccy"]
transfer.date = datetime.datetime.strptime(
entry.find("ns:BookgDt", ns).find("ns:DtTm", ns).text,
"%Y-%m-%dT%H:%M:%S",
).date()
transfer.title = txdtls.find("ns:RmtInf", ns).find("ns:Ustrd", ns).text
yield transfer
@ -375,6 +376,7 @@ if __name__ == "__main__":
logging.basicConfig(level=config['logging']['level'], format=config['logging'].get('format', '%(asctime)s [%(levelname)s] %(name)s: %(message)s'))
logging.getLogger('chardet').setLevel(logging.WARN)
logging.getLogger('charset_normalizer').setLevel(logging.WARN)
CACHE_DIR = config['general']['cache_dir']
engine = create_engine(config['database']['uri'])

View file

@ -22,9 +22,9 @@ def index():
members = [m.get_status() for m in models.Member.get_members(True)]
for member in members:
due = member['months_due']
if due < 1:
if due is not None and due < 1:
member['color'] = "00FF00"
elif due < 3:
elif due is not None and due < 3:
member['color'] = "E0941B"
else:
member['color'] = "FF0000"

View file

@ -4,7 +4,7 @@ with transfer2 as (
-- case type when 'IN' then amount when 'OUT' then -amount when 'BANK_FEE' then -amount else NULL end as amount_rel,
case type when 'IN' then amount when 'OUT' then -amount when 'BANK_FEE' then -amount when 'IN_FROM_OWN' then amount when 'OUT_TO_OWN' then -amount else NULL end as amount_rel,
currency,
to_name
coalesce(to_name, '') as to_name
from raw_transfer
where
on_account in ('PL48195000012006000648890002', 'PL91195000012006000648890004', 'PL64195000012006000648890005', 'PL21195000012006000648890003')