Merge branch 'master' into address_label

This commit is contained in:
David Kilias 2020-03-14 13:21:03 +01:00
commit b25c673055

View file

@ -3,7 +3,7 @@
import npyscreen import npyscreen
import json import json
from datetime import date import datetime
from sys import argv from sys import argv
@ -91,13 +91,20 @@ def main(*_args):
zip(app.finance_widgets.keys(), map(lambda f: f.value, app.finance_widgets.values()))) zip(app.finance_widgets.keys(), map(lambda f: f.value, app.finance_widgets.values())))
new_data['mitgliederdaten'] = dict( new_data['mitgliederdaten'] = dict(
zip(app.member_widgets.keys(), map(lambda f: f.value, app.member_widgets.values()))) zip(app.member_widgets.keys(), map(lambda f: f.value, app.member_widgets.values())))
new_data['stammdaten'] = dict(zip(app.base_data_widgets.keys(), map(lambda f: f.value, app.base_data_widgets.values())))
new_data['stammdaten']['address_label'] = \ new_data['stammdaten']['address_label'] = \
f"{new_data['stammdaten']['fullname']}\n\ f"{new_data['stammdaten']['fullname']}\n\
{new_data['stammdaten']['address_street']}\n\ {new_data['stammdaten']['address_street']}\n\
{new_data['stammdaten']['address_code']} {new_data['stammdaten']['address_locality']}" {new_data['stammdaten']['address_code']} {new_data['stammdaten']['address_locality']}"
outfile_name = '{}_{}.json'.format(date.today().isoformat( new_data['finanzdaten'] = dict(zip(app.finance_widgets.keys(), map(lambda f: f.value, app.finance_widgets.values())))
), '_'.join(new_data['stammdaten']['fullname'].split())) new_data['mitgliederdaten'] = dict(zip(app.member_widgets.keys(), map(lambda f: f.value, app.member_widgets.values())))
new_data['timestamp'] = datetime.datetime.now().replace(microsecond=0).isoformat()
outfile_name = '{}_{}.json'.format('_'.join(new_data['stammdaten']['fullname'].split()), datetime.datetime.now().replace(microsecond=0).isoformat())
with open(outfile_name, 'w') as outfile: with open(outfile_name, 'w') as outfile:
json.dump(new_data, outfile, sort_keys=True, indent=4) json.dump(new_data, outfile, sort_keys=True, indent=4)