Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#1991] StatusTypeConfig configuration not refreshing #917

Merged
merged 3 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/open_inwoner/cms/cases/views/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,20 @@ class InnerCaseDetailView(
contact_form_class = CaseContactForm
case: Optional[Zaak] = None

def __init__(self):
def store_statustype_resulttype_mapping(self, zaaktype_identificatie):
# Filter on ZaakType identificatie to avoid eSuite situation where one statustype
# is linked to multiple zaaktypes
self.statustype_config_mapping = {
zaaktype_statustype.statustype_url: zaaktype_statustype
for zaaktype_statustype in ZaakTypeStatusTypeConfig.objects.all()
for zaaktype_statustype in ZaakTypeStatusTypeConfig.objects.filter(
zaaktype_config__identificatie=zaaktype_identificatie
)
}
self.resulttype_config_mapping = {
zt_resulttype.resultaattype_url: zt_resulttype
for zt_resulttype in ZaakTypeResultaatTypeConfig.objects.all()
for zt_resulttype in ZaakTypeResultaatTypeConfig.objects.filter(
zaaktype_config__identificatie=zaaktype_identificatie
)
}

@cached_property
Expand Down Expand Up @@ -134,6 +140,7 @@ def get_context_data(self, **kwargs):
# fetch data associated with `self.case`
documents = self.get_case_document_files(self.case)
statuses = fetch_status_history(self.case.url)
self.store_statustype_resulttype_mapping(self.case.zaaktype.identificatie)
# NOTE maybe this should be cached?
statustypen = fetch_status_types_no_cache(self.case.zaaktype.url)

Expand Down
8 changes: 8 additions & 0 deletions src/open_inwoner/openzaak/tests/test_case_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def setUpTestData(cls):
beginGeldigheid="2020-09-25",
versiedatum="2020-09-25",
)
cls.zaaktype_config = ZaakTypeConfigFactory.create(
identificatie=cls.zaaktype["identificatie"],
)
#
# statuses
#
Expand Down Expand Up @@ -559,11 +562,13 @@ def test_status_is_retrieved_when_user_logged_in_via_digid(self, m):
self.maxDiff = None

ZaakTypeStatusTypeConfigFactory.create(
zaaktype_config=self.zaaktype_config,
statustype_url=self.status_type_new["url"],
status_indicator=StatusIndicators.warning,
status_indicator_text="foo",
)
ZaakTypeStatusTypeConfigFactory.create(
zaaktype_config=self.zaaktype_config,
statustype_url=self.status_type_finish["url"],
status_indicator=StatusIndicators.success,
status_indicator_text="bar",
Expand Down Expand Up @@ -636,16 +641,19 @@ def test_pass_endstatus_type_data_if_endstatus_not_reached(self, m):
self.maxDiff = None

ZaakTypeStatusTypeConfigFactory.create(
zaaktype_config=self.zaaktype_config,
statustype_url=self.status_type_new["url"],
status_indicator=StatusIndicators.warning,
status_indicator_text="foo",
)
ZaakTypeStatusTypeConfigFactory.create(
zaaktype_config=self.zaaktype_config,
statustype_url=self.status_type_in_behandeling["url"],
status_indicator=StatusIndicators.success,
status_indicator_text="zap",
)
ZaakTypeStatusTypeConfigFactory.create(
zaaktype_config=self.zaaktype_config,
statustype_url=self.status_type_finish["url"],
status_indicator=StatusIndicators.success,
status_indicator_text="bar",
Expand Down
Loading