Skip to content

Commit

Permalink
Merge pull request #981 from maykinmedia/issue/2037-missing-statusses
Browse files Browse the repository at this point in the history
[#2037] Workaround for missing statusses from the eSuite statuslist endpoint
  • Loading branch information
alextreme authored Jan 23, 2024
2 parents c63452b + 68b038d commit ccf1bd5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions src/open_inwoner/cms/cases/views/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
fetch_case_information_objects_for_case_and_info,
fetch_case_roles,
fetch_single_result,
fetch_single_status,
fetch_status_history,
)
from open_inwoner.openzaak.catalog import (
Expand Down Expand Up @@ -168,6 +169,13 @@ def get_context_data(self, **kwargs):
if self.case.status == status.url:
self.case.status = status

if type(self.case.status) == str:
logger.info(
"Issue #2037 -- Retrieving status individually to deal with the situation where eSuite doesnt return current status as part of statuslist retrieval"
)
self.case.status = fetch_single_status(self.case.status)
status_types[self.case.status.statustype].append(self.case.status)

for status_type_url, _statuses in list(status_types.items()):
# todo parallel
status_type = fetch_single_status_type(status_type_url)
Expand Down Expand Up @@ -317,21 +325,23 @@ def is_file_upload_enabled_for_statustype(self) -> bool:
enabled_for_status_type = self.statustype_config_mapping[
self.case.status.statustype.url
].document_upload_enabled
except AttributeError:
except AttributeError as e:
logger.exception(e)
logger.info(
"Could not retrieve status type for case {case}; "
"the status has not been resolved to a ZGW model object.".format(
case=self.case
)
)
return False
except KeyError:
return True
except KeyError as e:
logger.exception(e)
logger.info(
"Could not retrieve status type config for url {url}".format(
url=self.case.status.statustype.url
)
)
return False
return True
logger.info(
"Case {url} status type {status_type} has status type file upload: {enabled_for_status_type}".format(
url=self.case.url,
Expand Down
3 changes: 2 additions & 1 deletion src/open_inwoner/openzaak/tests/test_case_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def setUpTestData(cls):
cls.status_new = generate_oas_component(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da81560-c7fc-476a-ad13-beu760sle929",
url=f"{ZAKEN_ROOT}statussen/3da89990-c7fc-476a-ad13-c9023450083c",
zaak=cls.zaak["url"],
statustype=f"{CATALOGI_ROOT}statustypen/e3798107-ab27-4c3c-977d-777yu878km09",
datumStatusGezet="2021-01-12",
Expand Down Expand Up @@ -507,6 +507,7 @@ def _setUpMocks(self, m, use_eindstatus=True):
self.status_type_new,
self.status_type_in_behandeling,
self.status_type_finish,
self.status_new,
]:
m.get(resource["url"], json=resource)

Expand Down

0 comments on commit ccf1bd5

Please sign in to comment.