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

[#2899] Integrate OpenKlantConfig and OpenKlant2Config #1520

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

pi-sigma
Copy link
Contributor

@pi-sigma pi-sigma commented Dec 5, 2024

No description provided.

@pi-sigma pi-sigma force-pushed the task/2899-openklant2-config branch 2 times, most recently from 6e72745 to 33b0d88 Compare January 7, 2025 16:14
@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 89.89899% with 20 lines in your changes missing coverage. Please review.

Project coverage is 94.12%. Comparing base (235d0f0) to head (9becba5).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
src/open_inwoner/openklant/models.py 65.62% 11 Missing ⚠️
src/open_inwoner/cms/cases/tests/test_htmx.py 11.11% 8 Missing ⚠️
src/open_inwoner/openklant/admin.py 95.23% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1520      +/-   ##
===========================================
- Coverage    94.13%   94.12%   -0.02%     
===========================================
  Files         1064     1067       +3     
  Lines        39286    39337      +51     
===========================================
+ Hits         36982    37025      +43     
- Misses        2304     2312       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pi-sigma pi-sigma force-pushed the task/2899-openklant2-config branch from 33b0d88 to 35c4bed Compare January 8, 2025 11:29
@pi-sigma pi-sigma changed the title [#2899] Create MVP configuration model for OpenKlant2 [#2899] Integrate OpenKlantConfig and OpenKlant2Config Jan 8, 2025
@pi-sigma pi-sigma marked this pull request as ready for review January 8, 2025 13:25
@pi-sigma pi-sigma requested a review from swrichards January 8, 2025 13:25
@pi-sigma
Copy link
Contributor Author

pi-sigma commented Jan 8, 2025

@swrichards Keeping the service field on the OpenKlant2Config non-nullable is problematic when attempting to update the config for the first time: the get_or_create in the admin's change_view raises an IntegrityError because no zgw service is provided. I worked around this by creating a default API service and displaying a message to the user that they should update the service. However, it might just be simpler to make the field nullable, as in the old OpenKlantConfig. Unless you can think of some other way around this?

@swrichards
Copy link
Contributor

@swrichards Keeping the service field on the OpenKlant2Config non-nullable is problematic when attempting to update the config for the first time: the get_or_create in the admin's change_view raises an IntegrityError because no zgw service is provided. I worked around this by creating a default API service and displaying a message to the user that they should update the service. However, it might just be simpler to make the field nullable, as in the old OpenKlantConfig. Unless you can think of some other way around this?

@pi-sigma I am happy making the field nullable.

The general problem we have is that we want to know if the eSuite/OK2 service is correctly configured, and that does not play nice with SingletonModel as you say, because you have to be able to create it with sane defaults without user input. For now, I think we have to tackle this in our Service constructors: that is where we should fail loudly if:

  1. OpenKlant2 is configured as the primary
  2. But there is no service defined

Arguably we could also do this in the validation step for the global ok admin: if ok2 is selected there, you get a warning to first configure a service.

src/open_inwoner/openklant/models.py Outdated Show resolved Hide resolved
src/open_inwoner/openklant/models.py Outdated Show resolved Hide resolved
src/open_inwoner/openklant/admin.py Outdated Show resolved Hide resolved
src/open_inwoner/openklant/models.py Outdated Show resolved Hide resolved
@pi-sigma pi-sigma force-pushed the task/2899-openklant2-config branch from 35c4bed to f4a4870 Compare January 9, 2025 11:20
@pi-sigma pi-sigma marked this pull request as draft January 9, 2025 11:20
@pi-sigma pi-sigma force-pushed the task/2899-openklant2-config branch 2 times, most recently from c4fcd93 to 7131471 Compare January 9, 2025 11:39
@pi-sigma pi-sigma force-pushed the task/2899-openklant2-config branch from 7131471 to a521874 Compare January 9, 2025 13:02
@pi-sigma pi-sigma requested a review from swrichards January 9, 2025 15:02
@pi-sigma pi-sigma marked this pull request as ready for review January 9, 2025 15:02
Copy link
Contributor

@swrichards swrichards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, looks a lot better IMO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants