-
Notifications
You must be signed in to change notification settings - Fork 6
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
[#2277] Use first OIP subject for questions as fallback #1115
Conversation
@@ -131,7 +130,7 @@ def get_kcm_subject( | |||
kcm.contactmoment.url, | |||
exc_info=exc, | |||
) | |||
return e_suite_subject_code | |||
return ContactFormSubject.objects.first() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed and request is to split this up, situation with multipleobjectsreturned should show the first of the subjects with the subject_code matching the esuite subject code
* if multiple OIP subjects are assigned to the same e-suite subject code, we use the first OIP subject * if no mapping is configured for a particular e-suite subject code, we use the e-suite subject as fallback
258cdc7
to
1d11197
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1115 +/- ##
========================================
Coverage 95.01% 95.01%
========================================
Files 913 913
Lines 32126 32143 +17
========================================
+ Hits 30525 30542 +17
Misses 1601 1601 ☔ View full report in Codecov by Sentry. |
if not subject.subject: | ||
logger.warning( | ||
"Could not determine OIP subject for contactmoment %s; " | ||
"falling back on e-suite subject code ('onderwerp')", | ||
kcm.contactmoment.url, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be removed if we do this in the try ... except block: subject = ContactFormSubject.objects.get(~Q(subject=""), subject_code=e_suite_subject_code)
. Though on second thought, do we need this at all? ContactFormSubject.subject
is a required field: https://github.com/maykinmedia/open-inwoner/blob/develop/src/open_inwoner/openklant/models.py#L111-L114
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I've removed this part and modified the test.
If no mapping exists for e-suite for a particular e-suite subject code (or if duplicate codes exist), we use the first OIP configured subject as fallback
Taiga: #2277