diff --git a/edit_data_form.py b/edit_data_form.py index d2aefe2..2dc1e18 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -3,7 +3,7 @@ import npyscreen import json -from datetime import date +import datetime 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()))) new_data['mitgliederdaten'] = dict( 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'] = \ f"{new_data['stammdaten']['fullname']}\n\ {new_data['stammdaten']['address_street']}\n\ {new_data['stammdaten']['address_code']} {new_data['stammdaten']['address_locality']}" - outfile_name = '{}_{}.json'.format(date.today().isoformat( - ), '_'.join(new_data['stammdaten']['fullname'].split())) + new_data['finanzdaten'] = dict(zip(app.finance_widgets.keys(), map(lambda f: f.value, app.finance_widgets.values()))) + 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: json.dump(new_data, outfile, sort_keys=True, indent=4)