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

✨ [#2179] Display list of Qmatic appointments in profiel #1099

Merged
merged 5 commits into from
Mar 26, 2024

Conversation

stevenbal
Copy link
Contributor

@stevenbal stevenbal commented Mar 19, 2024

task: https://taiga.maykinmedia.nl/project/open-inwoner/task/2179

Can be tested by logging in with an account with email [email protected] and navigating to Mijn profiel

I adapted the client code from Open Forms and replaced TypedDict with pydantic's BaseModel to deserialize the data. Although we don't actually use the same client methods as OF (because OF implements creating appointments and we just need to implement the list of appointments + modify/cancel), this should probably be merged into a library at some point?

@stevenbal stevenbal marked this pull request as draft March 19, 2024 08:42
@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from 344d0c6 to c0b909e Compare March 19, 2024 10:16
@stevenbal stevenbal changed the title 🚧 [#2178] qmatic 🚧 [#2178] Qmatic appointment integration Mar 19, 2024
@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from c0b909e to e83be31 Compare March 19, 2024 11:07
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 73.52941% with 36 lines in your changes are missing coverage. Please review.

Project coverage is 94.92%. Comparing base (689245f) to head (e83be31).
Report is 6 commits behind head on develop.

Files Patch % Lines
src/open_inwoner/qmatic/client.py 69.31% 27 Missing ⚠️
src/open_inwoner/accounts/views/profile.py 38.46% 8 Missing ⚠️
src/open_inwoner/qmatic/models.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1099      +/-   ##
===========================================
- Coverage    95.02%   94.92%   -0.10%     
===========================================
  Files          911      919       +8     
  Lines        31991    32169     +178     
===========================================
+ Hits         30399    30537     +138     
- Misses        1592     1632      +40     

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

@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from e83be31 to 41f85fc Compare March 19, 2024 11:44
@stevenbal stevenbal changed the title 🚧 [#2178] Qmatic appointment integration ✨ [#2178] Qmatic appointment integration Mar 19, 2024
@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from 41f85fc to 6dd5f69 Compare March 19, 2024 11:50
@stevenbal stevenbal changed the title ✨ [#2178] Qmatic appointment integration ✨ [#2179] Qmatic appointment integration Mar 19, 2024
@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from 6dd5f69 to a1866a6 Compare March 19, 2024 14:21
@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from a1866a6 to a4e7f8c Compare March 19, 2024 14:24
Comment on lines +22 to +24
{% list_item text=appointment.branch.name caption=_("Locatie") compact=True strong=False %}
{% list_item text=appointment.branch.addressCity compact=True strong=False %}
{% list_item text=appointment.branch.addressLine2 compact=True strong=False %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if these are the right fields to display, because the documentation isn't too clear about what is stored in these fields

Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like a testing and acceptance problem 😉

context["appointments"] = []
else:
context["appointments"] = client.list_appointments_for_customer(
quote(self.request.user.email)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This assumes that the municipality uses a citizen's email as external_id in Qmatic (still awaiting confirmation from Hoorn if this is correct). If we want to support bsn or something else, we'll probably have to add a feature flag or choicefield on the config to enable that.

Copy link
Contributor

Choose a reason for hiding this comment

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

This quote() doesn't belong here but should be in the client method. It is not the responsibility of the using code to encode the values (as conceptually it doesn't even know how the client works internally).

This relates to my earlier comment I put in the client.

@stevenbal stevenbal changed the title ✨ [#2179] Qmatic appointment integration ✨ [#2179] Display list of Qmatic appointments in profiel Mar 19, 2024
@stevenbal stevenbal marked this pull request as ready for review March 21, 2024 08:53
Copy link
Contributor

@Bartvaderkin Bartvaderkin left a comment

Choose a reason for hiding this comment

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

Pretty clean, with some subtle feedback.

src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
Comment on lines +22 to +24
{% list_item text=appointment.branch.name caption=_("Locatie") compact=True strong=False %}
{% list_item text=appointment.branch.addressCity compact=True strong=False %}
{% list_item text=appointment.branch.addressLine2 compact=True strong=False %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like a testing and acceptance problem 😉

src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
context["appointments"] = []
else:
context["appointments"] = client.list_appointments_for_customer(
quote(self.request.user.email)
Copy link
Contributor

Choose a reason for hiding this comment

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

This quote() doesn't belong here but should be in the client method. It is not the responsibility of the using code to encode the values (as conceptually it doesn't even know how the client works internally).

This relates to my earlier comment I put in the client.

src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
@stevenbal stevenbal requested a review from Bartvaderkin March 21, 2024 11:35
Copy link
Contributor

@pi-sigma pi-sigma left a comment

Choose a reason for hiding this comment

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

Couple minor questions + suggestions


self.assertEqual(len(cards), 2)

passport_appointment = PQ(cards[0]).find("ul").children()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to use PyQuery directly, since you're already using response.pyquery, or just more convenient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It actually is necessary, it's a bit weird but for some reason I can't use .find and other methods on the element that I get from cards[0] directly

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks familiar: iirc pyquery doesn't wrap recursively like some other api's do.

src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
src/open_inwoner/qmatic/client.py Outdated Show resolved Hide resolved
src/open_inwoner/qmatic/models.py Show resolved Hide resolved
@stevenbal stevenbal force-pushed the feature/2178-qmatic-integration branch from 5efd9a9 to 6d1313e Compare March 21, 2024 12:52
@stevenbal
Copy link
Contributor Author

@Bartvaderkin can you re-review this? :)

@stevenbal stevenbal merged commit 4928b5d into develop Mar 26, 2024
15 checks passed
@stevenbal stevenbal deleted the feature/2178-qmatic-integration branch March 26, 2024 13:21
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.

4 participants