Skip to content

Commit

Permalink
[#2234] Determine subject for questions with + without e-suite code r…
Browse files Browse the repository at this point in the history
…eplacement
  • Loading branch information
pi-sigma committed Mar 19, 2024
1 parent 9253437 commit 6fcbb1d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/open_inwoner/accounts/views/contactmoments.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ def get_kcm_data(
),
}

# replace e_suite_subject_code with OIP configured subject, if applicable
e_suite_subject_code = getattr(kcm.contactmoment, "onderwerp", None)

data["onderwerp"] = self.get_kcm_subject(kcm, e_suite_subject_code)
data["onderwerp"] = self.get_kcm_subject(kcm)

return data

Expand All @@ -114,11 +111,14 @@ def get_context_data(self, **kwargs):
def get_kcm_subject(
self,
kcm: KlantContactMoment,
e_suite_subject_code: str | None,
) -> str | None:
"""
Try to determine the subject ('onderwerp') of a contactmoment
Determine the subject (`onderwerp`) of a `KlantContactMoment.contactmoment`:
1. by replacing e-suite subject code with OIP configured subject or
2. by returning e-suite subject code, if it exists
"""
e_suite_subject_code = getattr(kcm.contactmoment, "onderwerp", None)

if not e_suite_subject_code:
return None

Expand All @@ -133,7 +133,7 @@ def get_kcm_subject(
kcm.contactmoment.url,
exc_info=exc,
)
return None
return e_suite_subject_code

return subject.subject

Expand Down

0 comments on commit 6fcbb1d

Please sign in to comment.