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

(PC-32853)[API] feat: fix booking comparison date #14916

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AleksDPass
Copy link
Contributor

But de la pull request

Fix [POST] /stock/bulk
Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-32853
lien vers le bug sentry https://sentry.passculture.team/organizations/sentry/issues/1622746/?project=5&referrer=slack

Vérifications

  • J'ai écrit les tests nécessaires
  • J'ai mis à jour le fichier des plans de tests du portail pro si nécessaire
  • J'ai mis à jour la liste des routes et des titres de pages du portail pro si j'en ai rajouté/modifié ou supprimé une.
  • J'ai relu attentivement les migrations, en particulier pour éviter les locks, et je préviens les équipes Shérif et Data
  • J'ai ajouté des screenshots pour d'éventuels changements graphiques

Copy link
Contributor

github-actions bot commented Nov 5, 2024

mypy cop report: 453 (master) ↘ 452 (your branch)

Have yourself a merry little break and learn a few facts about the year 452.

@AleksDPass AleksDPass force-pushed the anougbele-pass/PC-32853-virtual-offer-in-check-booking-limit-datetime branch from c4b6efb to 597fd82 Compare November 5, 2024 19:26
],
)
def test_check_booking_limit_datetime_should_raise_because_booking_limit_is_one_hour_after(
self, stock_factory_function, offer_factory_function, venue_factory_fonction
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self, stock_factory_function, offer_factory_function, venue_factory_fonction
self, stock_factory, offer_factory, venue_factory

Pas besoin de préciser le _function, l'absence de majuscule me semble suffisante.
Je ferai bien même:

Suggested change
self, stock_factory_function, offer_factory_function, venue_factory_fonction
self, StockFactory, OfferFactory, VenueFactory

mais ça va surement faire raler pylint/mypy.

"offer.venue.timezone",
],
)
def test_check_booking_limit_datetime_priorisation_order(self, case):
Copy link
Contributor

Choose a reason for hiding this comment

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

case étant un mot clef (switch/case), j'opterai bien pour un nom différent.
pour des questions de lisibilité, plutot que de décrire le cas de test, je mettrai bien directement les variables:

  • OffererAddressFactory ou None pour la factory
  • "Indian/Reunion" / ` "America/Guadeloupe" / ZoneInfo("Europe/Paris") pour la TZ attendue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

j'ai pourtant voulu être clair. C'est raté

beginning_date = datetime.datetime(2024, 7, 19, 8, tzinfo=datetime.timezone.utc)
booking_limit_date = beginning_date - datetime.timedelta(hours=1)
if case == "offer.offerer_address.address.timezone":
booking_limit_date = beginning_date - datetime.timedelta(hours=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Je ne suis pas certain de comprende pourquoi on doit décaler booking_limit_date

@AleksDPass AleksDPass force-pushed the anougbele-pass/PC-32853-virtual-offer-in-check-booking-limit-datetime branch from 597fd82 to cb4500f Compare November 7, 2024 13:56
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.

2 participants