Skip to content

Commit

Permalink
[#2037] Workaround for missing statusses from the eSuite statuslist e…
Browse files Browse the repository at this point in the history
…ndpoint
  • Loading branch information
alextreme committed Jan 22, 2024
1 parent d117799 commit 6c8a123
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/open_inwoner/cms/cases/views/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,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 @@ -165,7 +166,12 @@ def get_context_data(self, **kwargs):
status_types[status.statustype].append(status)
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 @@ -307,21 +313,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

0 comments on commit 6c8a123

Please sign in to comment.