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

[#2277] Use first OIP subject for questions as fallback #1115

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

pi-sigma
Copy link
Contributor

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

@pi-sigma pi-sigma marked this pull request as ready for review March 25, 2024 12:50
@pi-sigma pi-sigma requested a review from stevenbal March 25, 2024 12:51
@@ -131,7 +130,7 @@ def get_kcm_subject(
kcm.contactmoment.url,
exc_info=exc,
)
return e_suite_subject_code
return ContactFormSubject.objects.first()
Copy link
Member

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

@pi-sigma pi-sigma marked this pull request as draft March 25, 2024 13:36
    * 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
@pi-sigma pi-sigma force-pushed the fix/2277-esuite-subject-mapping branch from 258cdc7 to 1d11197 Compare March 25, 2024 14:19
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.01%. Comparing base (f29e0af) to head (1d11197).

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.
📢 Have feedback on the report? Share it here.

@pi-sigma pi-sigma marked this pull request as ready for review March 25, 2024 15:10
Comment on lines 143 to 148
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,
)
Copy link
Contributor

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

Copy link
Contributor Author

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.

@stevenbal stevenbal self-requested a review March 26, 2024 13:12
@alextreme alextreme merged commit cef417f into develop Mar 26, 2024
15 checks passed
@alextreme alextreme deleted the fix/2277-esuite-subject-mapping branch March 26, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants