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-29597)[API] chore : read duration minutes from produts #14596

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mgeoffray-pass
Copy link
Contributor

But de la pull request

Ticket Jira (ou description si BSR) : https://passculture.atlassian.net/browse/PC-29597

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

@mgeoffray-pass mgeoffray-pass force-pushed the mageoffray/PC-29597-read-duration-minutes branch 2 times, most recently from 060ff8c to 2df764d Compare October 16, 2024 13:00
@@ -55,8 +55,7 @@ def synchronize(self) -> None:

product = self.get_or_create_movie_product(event)
offer = self.get_or_create_offer(event, self.provider.id, self.venue)
offer.product = product
Copy link
Contributor

Choose a reason for hiding this comment

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

On veut garder cette ligne non ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Je l'ai décalée plus bas dans le fill_offer_attribute. Si je la laisse ici j'ai un auto_flush si je fait un if offer.product: sqlalchemy flush l'offre et j'ai une erreur.
Dans le if product: j'ai mis le offer.product = product

@durationMinutes.setter
def durationMinutes(self, value: int | None) -> None:
if self.product:
self._durationMinutes = None
Copy link
Contributor

@tconte-pass tconte-pass Oct 16, 2024

Choose a reason for hiding this comment

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

On veut pas un warning ou autre pour dire que la fonction n'a pas l'effet escompté ? Voire une exception

@durationMinutes.setter
def durationMinutes(self, value: int | None) -> None:
if self.product:
self._durationMinutes = None
Copy link
Contributor

Choose a reason for hiding this comment

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

il n'y a pas de risque que le pro remplisse le champ et ne voit pas la modification attendue ?
Est-ce que l'on ne devrait pas lever une erreur explicite ?

@@ -17,7 +17,7 @@ def test_should_return_error_when_information_requires_a_string_type():
def test_should_return_error_when_information_requires_an_integer_type():
offer = offers_factories.OfferFactory.build(durationMinutes="not a number")
api_error = validate_generic(offer)
assert api_error.errors == {"durationMinutes": ["doit être un entier"]}
Copy link
Contributor

Choose a reason for hiding this comment

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

Il n'y a pas d'incompatibilité avec le front ? c'est dommage d'envoyer un champ et d'avoir une erreur sur un autre

if offer.product.extraData:
if product:
offer.name = product.name
offer.description = product.description
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A supprimer

@mgeoffray-pass mgeoffray-pass force-pushed the mageoffray/PC-29597-read-duration-minutes branch from 18799d8 to 0486699 Compare October 21, 2024 09:36
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.

5 participants