From afd418cd096e157830ba85056996d2ca75ba8e69 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Mon, 24 Oct 2022 23:51:29 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"Update=20example.json=20to=20hold?= =?UTF-8?q?=20schlie=C3=9Fberechtigung=20tags"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0808643674cc93741267010a042c2b258ccb4e92. --- example.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/example.json b/example.json index 482abd5..5e5008c 100644 --- a/example.json +++ b/example.json @@ -29,10 +29,7 @@ "bis": "", "mitgliedsbeitrag": "", "spendenbeitrag": "", - "schliessberechtigung": [ - "BLE", - "SSH" - ], + "schliessberechtigung": "", "scan-antrag": "" } -} +} \ No newline at end of file From 3b8a53fe40442e637b12d49f94e19f29f35b82a5 Mon Sep 17 00:00:00 2001 From: David Kilias Date: Mon, 24 Oct 2022 23:51:43 +0200 Subject: [PATCH 2/2] Revert "Add four options for schliessberechtigung" This reverts commit 55853c07e7196835abd3a41eabb2452788419d87. --- membership_data_model.py | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/membership_data_model.py b/membership_data_model.py index 7ecef38..df0eedb 100644 --- a/membership_data_model.py +++ b/membership_data_model.py @@ -6,12 +6,6 @@ class membership_data_model(): 'E': 'Ermäßigt', 'F': 'Fördermitglied' } - schliessberechtigung_values = [ - 'SSH', - 'BLE', - 'Telefon', - 'Metallschluessel' - ] def __init__(self, membership_data_dict): self.membership_data_dict = membership_data_dict @@ -19,12 +13,6 @@ class membership_data_model(): def add_edit_fields(self, parent_form): mem = self.membership_data_dict - - schliessberechtigung_value = [] - if 'schliessberechtigung' in mem.keys() and set(mem['schliessberechtigung']).issubset(set(self.schliessberechtigung_values)): - for entry in mem['schliessberechtigung']: - schliessberechtigung_value.append(self.schliessberechtigung_values.index(entry)) - status_value = 0 if 'status' in mem.keys() and mem['status'] in self.status_values.keys(): status_value = list(self.status_values.keys()).index(mem['status']) @@ -39,23 +27,14 @@ class membership_data_model(): value=mem['mitgliedsbeitrag']) self.forms['spendenbeitrag'] = parent_form.add(npyscreen.TitleText, begin_entry_at=20, use_two_lines=False, name="Spendenbeitrag: ", value=mem['spendenbeitrag']) - self.forms['schliessberechtigung'] = parent_form.add(npyscreen.TitleMultiSelect, name="Schliessberechtigung: ", - values = self.schliessberechtigung_values, - value = schliessberechtigung_value, - max_height = len(self.schliessberechtigung_values) + 1, - scroll_exit = True) + self.forms['schliessberechtigung'] = parent_form.add(npyscreen.TitleText, begin_entry_at=24, use_two_lines=False, name="Schliessberechtigung: ", + value=mem['schliessberechtigung']) self.forms['scan-antrag'] = parent_form.add(npyscreen.TitleText, begin_entry_at=18, use_two_lines=False, name="URI Scan Antrag: ", value=mem['scan-antrag']) def get_form_values_dict(self): membership_data_model = dict(zip(self.forms.keys(), map(lambda f: f.value, self.forms.values()))) membership_data_model['status'] = list(self.status_values.keys())[self.forms['status'].value[0]] - - if self.forms['schliessberechtigung'].get_selected_objects() is not None: - membership_data_model['schliessberechtigung'] = list(self.forms['schliessberechtigung'].get_selected_objects()) - else: - membership_data_model['schliessberechtigung'] = [] - return membership_data_model def has_changed(self):