From b23b5abe150dfdcb8d8c8536996f74d1fa1ed76f Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 14 Mar 2020 11:01:19 +0100 Subject: [PATCH 1/5] now with utc unix timestamp --- edit_data_form.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/edit_data_form.py b/edit_data_form.py index 686cfd9..457ce7e 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -4,6 +4,7 @@ import npyscreen import json from datetime import date +import time from sys import argv @@ -75,6 +76,8 @@ def main(*_args): new_data['stammdaten'] = dict(zip(app.sd2.keys(), map(lambda f: f.value, app.sd2.values()))) new_data['finanzdaten'] = dict(zip(app.fin2.keys(), map(lambda f: f.value, app.fin2.values()))) new_data['mitgliederdaten'] = dict(zip(app.mem2.keys(), map(lambda f: f.value, app.mem2.values()))) + new_data['timestamp'] = f"{int(time.time())}" + outfile_name = '{}_{}.json'.format(date.today().isoformat(), '_'.join(new_data['stammdaten']['fullname'].split())) with open(outfile_name, 'w') as outfile: json.dump(new_data, outfile, sort_keys=True, indent=4) From 715871dfbfd15514b9c3553534f3101f4547664e Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 14 Mar 2020 12:40:15 +0100 Subject: [PATCH 2/5] change timestamp to iso8601 --- edit_data_form.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/edit_data_form.py b/edit_data_form.py index 457ce7e..173646c 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 import time from sys import argv @@ -76,9 +76,9 @@ def main(*_args): new_data['stammdaten'] = dict(zip(app.sd2.keys(), map(lambda f: f.value, app.sd2.values()))) new_data['finanzdaten'] = dict(zip(app.fin2.keys(), map(lambda f: f.value, app.fin2.values()))) new_data['mitgliederdaten'] = dict(zip(app.mem2.keys(), map(lambda f: f.value, app.mem2.values()))) - new_data['timestamp'] = f"{int(time.time())}" + new_data['timestamp'] = datetime.datetime.now().replace(microsecond=0).isoformat() - outfile_name = '{}_{}.json'.format(date.today().isoformat(), '_'.join(new_data['stammdaten']['fullname'].split())) + outfile_name = '{}_{}.json'.format(datetime.date.today().isoformat(), '_'.join(new_data['stammdaten']['fullname'].split())) with open(outfile_name, 'w') as outfile: json.dump(new_data, outfile, sort_keys=True, indent=4) From 51b3dde78e2144399122bf61d8c4577feaf7011a Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 14 Mar 2020 13:02:03 +0100 Subject: [PATCH 3/5] put timestamp after name in filename --- edit_data_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edit_data_form.py b/edit_data_form.py index 173646c..52ed9e5 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -78,7 +78,7 @@ def main(*_args): new_data['mitgliederdaten'] = dict(zip(app.mem2.keys(), map(lambda f: f.value, app.mem2.values()))) new_data['timestamp'] = datetime.datetime.now().replace(microsecond=0).isoformat() - outfile_name = '{}_{}.json'.format(datetime.date.today().isoformat(), '_'.join(new_data['stammdaten']['fullname'].split())) + outfile_name = '{}_{}.json'.format('_'.join(new_data['stammdaten']['fullname'].split()),datetime.date.today().isoformat()) with open(outfile_name, 'w') as outfile: json.dump(new_data, outfile, sort_keys=True, indent=4) From f15c6a6b75431804f7bea4847eb3dd2ca4144019 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 14 Mar 2020 13:03:17 +0100 Subject: [PATCH 4/5] put full isodate with second precision in filename --- edit_data_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edit_data_form.py b/edit_data_form.py index 52ed9e5..a7d5ee1 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -78,7 +78,7 @@ def main(*_args): new_data['mitgliederdaten'] = dict(zip(app.mem2.keys(), map(lambda f: f.value, app.mem2.values()))) new_data['timestamp'] = datetime.datetime.now().replace(microsecond=0).isoformat() - outfile_name = '{}_{}.json'.format('_'.join(new_data['stammdaten']['fullname'].split()),datetime.date.today().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) From f37c381fed4ac99fa5743181f4bcf01b22634b21 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Sat, 14 Mar 2020 13:04:50 +0100 Subject: [PATCH 5/5] remove unused import --- edit_data_form.py | 1 - 1 file changed, 1 deletion(-) diff --git a/edit_data_form.py b/edit_data_form.py index a7d5ee1..4914660 100755 --- a/edit_data_form.py +++ b/edit_data_form.py @@ -4,7 +4,6 @@ import npyscreen import json import datetime -import time from sys import argv