diff --git a/src/open_inwoner/cms/cases/tests/test_contactform.py b/src/open_inwoner/cms/cases/tests/test_contactform.py index 13360b04cd..dcb3e099b5 100644 --- a/src/open_inwoner/cms/cases/tests/test_contactform.py +++ b/src/open_inwoner/cms/cases/tests/test_contactform.py @@ -221,12 +221,23 @@ def setUp(self): volgnummer=1, isEindstatus=True, ) + self.resultaattype_with_naam = generate_oas_component_cached( + "ztc", + "schemas/ResultaatType", + url=f"{CATALOGI_ROOT}resultaattypen/b1a268dd-4322-47bb-a930-b83066b4a32c", + zaaktype=self.zaaktype["url"], + omschrijving="Short description", + resultaattypeomschrijving="http://example.com", + selectielijstklasse="http://example.com", + naam="Long description (>20 chars) of result", + ) self.result = generate_oas_component_cached( "zrc", "schemas/Resultaat", uuid="a44153aa-ad2c-6a07-be75-15add5113", url=self.zaak["resultaat"], - resultaattype=f"{CATALOGI_ROOT}resultaattypen/b1a268dd-4322-47bb-a930-b83066b4a32c", + # resultaattype=f"{CATALOGI_ROOT}resultaattypen/b1a268dd-4322-47bb-a930-b83066b4a32c", + resultaattype=self.resultaattype_with_naam["url"], zaak=self.zaak["url"], toelichting="resultaat toelichting", ) @@ -260,6 +271,7 @@ def _setUpMocks(self, m): for resource in [ self.zaak, self.result, + self.resultaattype_with_naam, self.zaaktype, self.status_finish, self.status_type_finish, diff --git a/src/open_inwoner/cms/cases/tests/test_htmx.py b/src/open_inwoner/cms/cases/tests/test_htmx.py index dd5a766784..309796a7c6 100644 --- a/src/open_inwoner/cms/cases/tests/test_htmx.py +++ b/src/open_inwoner/cms/cases/tests/test_htmx.py @@ -188,12 +188,22 @@ def setUp(self) -> None: "geslachtsnaam": "Bazz", }, ) + self.resultaattype_with_naam = generate_oas_component_cached( + "ztc", + "schemas/ResultaatType", + url=f"{CATALOGI_ROOT}resultaattypen/b1a268dd-4322-47bb-a930-b83066b4a32c", + zaaktype=self.zaaktype["url"], + omschrijving="Short description", + resultaattypeomschrijving="http://example.com", + selectielijstklasse="http://example.com", + naam="Long description (>20 chars) of result", + ) self.result = generate_oas_component_cached( "zrc", "schemas/Resultaat", uuid="a44153aa-ad2c-6a07-be75-15add5113", url=self.zaak["resultaat"], - resultaattype=f"{CATALOGI_ROOT}resultaattypen/b1a268dd-4322-47bb-a930-b83066b4a32c", + resultaattype=self.resultaattype_with_naam["url"], zaak=self.zaak["url"], toelichting="resultaat toelichting", ) @@ -324,6 +334,7 @@ def _setUpMocks(self, m): for resource in [ self.zaak, + self.resultaattype_with_naam, self.result, self.zaaktype, self.status_type_new, diff --git a/src/open_inwoner/cms/cases/views/status.py b/src/open_inwoner/cms/cases/views/status.py index 1414ee9f5c..c8ad5e6507 100644 --- a/src/open_inwoner/cms/cases/views/status.py +++ b/src/open_inwoner/cms/cases/views/status.py @@ -205,7 +205,10 @@ def get_context_data(self, **kwargs): end_statustype=self.handle_end_statustype(statuses, statustypen), ) result_data = self.get_result_data( - self.case, self.resulttype_config_mapping, zaken_client + self.case, + self.resulttype_config_mapping, + zaken_client, + catalogi_client, ) hooks.case_status_seen(self.request.user, self.case) @@ -526,15 +529,28 @@ def get_upload_info_context(self, case: Zaak): @staticmethod def get_result_data( - case: Zaak, result_type_config_mapping: dict, client: ZakenClient + case: Zaak, + result_type_config_mapping: dict, + zaken_client: ZakenClient, + catalogi_client: CatalogiClient, ) -> dict: + """ + Get display and description for the result of `case` + + Note: + For the description, we try the `esuite_compat_naam` attribute of the corresponding + resultaattype first. This is for E-suite compatibility in case the E-suite returns + a description longer than 20 chars. Alternatively, we get the description from the + config of the resultaattype. + """ if not case.resultaat: return {} - result = client.fetch_single_result(case.resultaat) + result = zaken_client.fetch_single_result(case.resultaat) + result_type = catalogi_client.fetch_single_resultaat_type(result.resultaattype) display = result.toelichting - description = getattr( + description = getattr(result_type, "esuite_compat_naam", "") or getattr( result_type_config_mapping.get(result.resultaattype), "description", "" ) diff --git a/src/open_inwoner/configurations/tests/bootstrap/test_setup_cms.py b/src/open_inwoner/configurations/tests/bootstrap/test_setup_cms.py index 863188153b..e83bd67e0c 100644 --- a/src/open_inwoner/configurations/tests/bootstrap/test_setup_cms.py +++ b/src/open_inwoner/configurations/tests/bootstrap/test_setup_cms.py @@ -153,7 +153,6 @@ def test_cms_ssd_override_settings(self): self.assertTrue(benefits_page_is_published()) - # import pdbr;pdbr.set_trace() # check common extension page = Page.objects.get(publisher_is_draft=False) extension = page.commonextension diff --git a/src/open_inwoner/openzaak/api_models.py b/src/open_inwoner/openzaak/api_models.py index 27f3c89dec..2a8cc01560 100644 --- a/src/open_inwoner/openzaak/api_models.py +++ b/src/open_inwoner/openzaak/api_models.py @@ -232,7 +232,8 @@ class ResultaatType(ZGWModel): brondatum_archiefprocedure: Optional[dict] = None # E-suite compatibility - naam: str = "" # for result description ("omschrijving") with >20 chars + # result description ("omschrijving") with >20 chars + esuite_compat_naam: str = "" @dataclass diff --git a/src/open_inwoner/openzaak/tests/factories.py b/src/open_inwoner/openzaak/tests/factories.py index 12dc867862..39e9a2c27e 100644 --- a/src/open_inwoner/openzaak/tests/factories.py +++ b/src/open_inwoner/openzaak/tests/factories.py @@ -17,6 +17,7 @@ UserCaseStatusNotification, ZaakTypeConfig, ZaakTypeInformatieObjectTypeConfig, + ZaakTypeResultaatTypeConfig, ZaakTypeStatusTypeConfig, ZGWApiGroupConfig, ) @@ -90,6 +91,13 @@ class Meta: model = ZaakTypeConfig +class ZaakTypeResultaatTypeConfigFactory(factory.django.DjangoModelFactory): + zaaktype_config = factory.SubFactory(ZaakTypeConfigFactory) + + class Meta: + model = ZaakTypeResultaatTypeConfig + + class ZaakTypeInformatieObjectTypeConfigFactory(factory.django.DjangoModelFactory): zaaktype_config = factory.SubFactory(ZaakTypeConfigFactory) informatieobjecttype_url = factory.Faker("url") diff --git a/src/open_inwoner/openzaak/tests/test_case_detail.py b/src/open_inwoner/openzaak/tests/test_case_detail.py index 896d42cc2d..81181351ed 100644 --- a/src/open_inwoner/openzaak/tests/test_case_detail.py +++ b/src/open_inwoner/openzaak/tests/test_case_detail.py @@ -36,6 +36,7 @@ from open_inwoner.openzaak.tests.factories import ( ZaakTypeConfigFactory, ZaakTypeInformatieObjectTypeConfigFactory, + ZaakTypeResultaatTypeConfigFactory, ZaakTypeStatusTypeConfigFactory, ) from open_inwoner.utils.test import ( @@ -127,7 +128,7 @@ def setUp(self): # # Catalogi API (ZTC) - # https://test.openzaak.nl/catalogi/api/v1/schema/ + # https://vng-realisatie.github.io/gemma-zaken/standaard/catalogi/ # self.zaaktype = generate_oas_component_cached( "ztc", @@ -223,10 +224,20 @@ def setUp(self): richting="inkomend", statustype=self.status_type_finish, ) + self.resultaattype_with_naam = generate_oas_component_cached( + "ztc", + "schemas/ResultaatType", + url=f"{CATALOGI_ROOT}resultaattypen/3dc5e2d3-ed72-41ec-a91e-000f72a7b291", + zaaktype=self.zaaktype["url"], + omschrijving="Short description", + resultaattypeomschrijving="http://example.com", + selectielijstklasse="http://example.com", + esuite_compat_naam="Long description (>20 chars) of result", + ) # # Documenten API (DRC) - # https://test.openzaak.nl/documenten/api/v1/schema/ + # https://vng-realisatie.github.io/gemma-zaken/standaard/documenten/ # self.informatie_object = generate_oas_component_cached( "drc", @@ -295,7 +306,7 @@ def setUp(self): # # Zaken API (ZRC) - # https://test.openzaak.nl/zaken/api/v1/schema/ + # https://vng-realisatie.github.io/gemma-zaken/standaard/zaken/ # self.zaak = generate_oas_component_cached( "zrc", @@ -428,7 +439,7 @@ def setUp(self): "schemas/Resultaat", uuid="a44153aa-ad2c-6a07-be75-15add5113", url=self.zaak["resultaat"], - resultaattype=f"{CATALOGI_ROOT}resultaattypen/b1a268dd-4322-47bb-a930-b83066b4a32c", + resultaattype=self.resultaattype_with_naam["url"], zaak=self.zaak["url"], toelichting="resultaat toelichting", ) @@ -594,6 +605,7 @@ def _setUpMocks(self, m, use_eindstatus=True): self.informatie_object, self.informatie_object_2, self.informatie_object_invisible, + self.resultaattype_with_naam, self.zaaktype_informatie_object_type, self.status_type_new, self.status_type_in_behandeling, @@ -726,6 +738,13 @@ def test_status_is_retrieved_when_user_logged_in_via_digid( case_link_text="Bekijk aanvraag", ) + ZaakTypeResultaatTypeConfigFactory.create( + zaaktype_config=self.zaaktype_config, + resultaattype_url=self.resultaattype_with_naam["url"], + omschrijving=self.resultaattype_with_naam["omschrijving"], + zaaktype_uuids=[self.zaaktype["uuid"]], + ) + self._setUpMocks(m) status_new_obj, status_finish_obj = factory( Status, [self.status_new, self.status_finish] @@ -779,7 +798,7 @@ def test_status_is_retrieved_when_user_logged_in_via_digid( ], "initiator": "Foo Bar van der Bazz", "result": "resultaat toelichting", - "result_description": "", + "result_description": "Long description (>20 chars) of result", "case_type_config_description": "", "case_type_document_upload_description": "", "internal_upload_enabled": False, @@ -901,7 +920,7 @@ def test_pass_endstatus_type_data_if_endstatus_not_reached(self, m): ], "initiator": "Foo Bar van der Bazz", "result": "resultaat toelichting", - "result_description": "", + "result_description": "Long description (>20 chars) of result", "case_type_config_description": "", "case_type_document_upload_description": "", "internal_upload_enabled": False,