Skip to content

Commit

Permalink
[#2935] Mijn Afspraken: Don't show appoinments from the past
Browse files Browse the repository at this point in the history
  • Loading branch information
alextreme committed Dec 27, 2024
1 parent 9fb8360 commit 424d4cf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/open_inwoner/accounts/tests/test_profile_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,7 @@ def test_render_list_if_appointments_are_found(self, m):

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

self.assertEqual(PQ(passport_appointment[0]).text(), "Datum\n1 januari 2020")
self.assertEqual(PQ(passport_appointment[0]).text(), "Datum\n1 januari 2030")
self.assertEqual(PQ(passport_appointment[1]).text(), "Tijd\n13:00 uur")
self.assertEqual(PQ(passport_appointment[2]).text(), "Locatie\nHoofdkantoor")
self.assertEqual(PQ(passport_appointment[3]).text(), "Dam 1")
Expand All @@ -1509,7 +1509,7 @@ def test_render_list_if_appointments_are_found(self, m):

id_card_appointment = PQ(cards[1]).find("ul").children()

self.assertEqual(PQ(id_card_appointment[0]).text(), "Datum\n6 maart 2020")
self.assertEqual(PQ(id_card_appointment[0]).text(), "Datum\n6 maart 2030")
self.assertEqual(PQ(id_card_appointment[1]).text(), "Tijd\n11:30 uur")
self.assertEqual(PQ(id_card_appointment[2]).text(), "Locatie\nHoofdkantoor")
self.assertEqual(PQ(id_card_appointment[3]).text(), "Wall Street 1")
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/cms/plugins/tests/test_appointments.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def test_plugin(self, m):
aanvraag_id_kaart_date = PQ(items.find("p.tabled__value")[1]).text()
aanvraag_id_kaart_title = PQ(items.find(".plugin-card__heading")[1]).text()

self.assertEqual(aanvraag_paspoort_date, "1 januari 2020 om 13:00 uur")
self.assertEqual(aanvraag_paspoort_date, "1 januari 2030 om 13:00 uur")
self.assertEqual(aanvraag_paspoort_title, "Paspoort")
self.assertEqual(aanvraag_id_kaart_date, "6 maart 2020 om 11:30 uur")
self.assertEqual(aanvraag_id_kaart_date, "6 maart 2030 om 11:30 uur")
self.assertEqual(aanvraag_id_kaart_title, "ID kaart")

action_url = items[0].attrib["href"]
Expand Down
6 changes: 5 additions & 1 deletion src/open_inwoner/qmatic/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from datetime import datetime
from datetime import date, datetime
from urllib.parse import quote

from ape_pie.client import APIClient
Expand Down Expand Up @@ -144,10 +144,14 @@ def list_appointments_for_customer(self, email: str) -> list[Appointment]:
return []
response.raise_for_status()
config = QmaticConfig.get_solo()
today = date.today()
try:
appointments = [
Appointment(**entry) for entry in response.json()["appointmentList"]
]
appointments = [
entry for entry in appointments if entry.start.date() >= today
]
for appointment in appointments:
appointment.url = (
f"{config.booking_base_url}{quote(appointment.publicId)}"
Expand Down
4 changes: 2 additions & 2 deletions src/open_inwoner/qmatic/tests/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self):

self.appointment_passport = AppointmentFactory.build(
title="Qmatic web booking",
start="2020-01-01T12:00:00+00:00",
start="2030-01-01T12:00:00+00:00",
notes="foo",
branch=BranchDetailFactory.build(
name="Hoofdkantoor",
Expand All @@ -49,7 +49,7 @@ def __init__(self):
)
self.appointment_idcard = AppointmentFactory.build(
title="Qmatic web booking",
start="2020-03-06T16:30:00+00:00",
start="2030-03-06T16:30:00+00:00",
notes="bar",
branch=BranchDetailFactory.build(
name="Hoofdkantoor",
Expand Down

0 comments on commit 424d4cf

Please sign in to comment.