@@ -84,6 +84,22 @@ def expand_procestype(zaak: dict) -> dict:
84
84
return processed_zaken
85
85
86
86
87
+ def _format_zaaktypen_choices (
88
+ zaaktypen : list , zaaktypen_to_include : list | None = None
89
+ ) -> list [DropDownChoice ]:
90
+ formatted_choices = []
91
+ for key , value in zaaktypen .items ():
92
+ item = {"label" : key or _ ("(no identificatie)" ), "value" : "," .join (value )}
93
+ if zaaktypen_to_include is None :
94
+ formatted_choices .append (item )
95
+ continue
96
+
97
+ if key in zaaktypen_to_include :
98
+ formatted_choices .append (item )
99
+
100
+ return sorted (formatted_choices , key = lambda zaaktype : zaaktype ["label" ])
101
+
102
+
87
103
def retrieve_zaaktypen_choices () -> list [DropDownChoice ]:
88
104
ztc_service = Service .objects .filter (api_type = APITypes .ztc ).first ()
89
105
if not ztc_service :
@@ -108,12 +124,7 @@ def retrieve_zaaktypen_choices() -> list[DropDownChoice]:
108
124
.values_list ("_expand__zaaktype__identificatie" , flat = True )
109
125
.distinct ()
110
126
)
111
- zaaktypen_choices = [
112
- {"label" : key or _ ("(no identificatie)" ), "value" : "," .join (value )}
113
- for key , value in zaaktypen .items ()
114
- if key in zaaktypes_to_include
115
- ]
116
- return sorted (zaaktypen_choices , key = lambda zaaktype : zaaktype ["label" ])
127
+ return _format_zaaktypen_choices (zaaktypen , zaaktypes_to_include )
117
128
118
129
119
130
def _get_zaaktype_choices (zaaktypen_to_include : dict [list ]) -> list [DropDownChoice ]:
@@ -125,10 +136,7 @@ def _get_zaaktype_choices(zaaktypen_to_include: dict[list]) -> list[DropDownChoi
125
136
for zaaktype_url , zaaktype_identificatie in zaaktypen_to_include :
126
137
zaaktypen [zaaktype_identificatie ].append (zaaktype_url )
127
138
128
- zaaktypen_choices = [
129
- {"label" : key , "value" : "," .join (value )} for key , value in zaaktypen .items ()
130
- ]
131
- return sorted (zaaktypen_choices , key = lambda zaaktype : zaaktype ["label" ])
139
+ return _format_zaaktypen_choices (zaaktypen )
132
140
133
141
134
142
def get_zaaktypen_choices_from_list (
0 commit comments