Skip to content

Commit 95a4ce3

Browse files
committed
🚸 [#319] feat: Change label and order of ProcesType options
IMHO, having the "nummer" first gives better UX, because the user knows the number they need by heart, and the most recent jaar is most often needed. ```python return OBOption(label=f"{arg.nummer} - {arg.jaar} - {arg.naam}", value=arg.url) ```
1 parent 7646840 commit 95a4ce3

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

backend/src/openbeheer/types/_open_beheer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def fetch_procestype_options():
209209

210210
procestypen = decode(response.content, type=list[LAXProcesType])
211211
return [
212-
as_ob_option(p) for p in sorted(procestypen, key=lambda v: (-v.jaar, v.naam))
212+
as_ob_option(p) for p in sorted(procestypen, key=lambda v: (-v.jaar, v.nummer))
213213
]
214214

215215

@@ -783,7 +783,7 @@ class ExpandableZaakType(ZaakTypeWithUUID, Struct):
783783

784784
@as_ob_option.register
785785
def _lax_procestype_as_option(arg: ProcesType) -> OBOption[str | None]:
786-
return OBOption(label=f"{arg.naam} - {arg.jaar}", value=arg.url)
786+
return OBOption(label=f"{arg.jaar} - {arg.nummer} - {arg.naam}", value=arg.url)
787787

788788

789789
# Types from read only (or not implemented CUD) API's

backend/src/openbeheer/zaaktype/tests/test_zaaktype_detail.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,8 @@ def test_selectielijst_procestype_options(self):
770770
# Value should be a URL
771771
self.assertIn("https://", value)
772772

773-
# Within same year, should be sorted alphabetically
774-
if year == previous_year:
775-
self.assertGreater(label, previous_label)
776773
# Years should be descending.
777-
else:
778-
self.assertLess(year, previous_year)
774+
self.assertLessEqual(year, previous_year)
779775

780776
previous = option
781777

0 commit comments

Comments
 (0)