Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Pc 1647 merge event occurrence into stock #491

Merged
merged 24 commits into from
Mar 28, 2019

Conversation

abel-andre
Copy link
Contributor

No description provided.

@abel-andre abel-andre force-pushed the PC-1647-merge-event-occurrence-into-stock branch 2 times, most recently from ea3b373 to 9453a62 Compare March 19, 2019 10:23
@annemarie35 annemarie35 self-requested a review March 20, 2019 12:57
self.eventOccurrences)))
else:
return []

@property
def lastStock(self):
query = Stock.queryNotSoftDeleted()
Copy link
Contributor

Choose a reason for hiding this comment

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

Pour ma compréhension du code (cf les fichiers contributing), queryNotSoftDeleted() ne devrait-il pas être dans repository/stock_queries.py ? Car là, il est dans /models/stock.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Théoriquement si, il faudrait que cette query soit dans un module de repository. Mais ça poserait un problème de dépendence circulaire:

  • le package models dépendrait du package repository
  • le package repository dépendrait du package models
  • le package models dépendrait du package repository
  • 💥

Donc en l'état on ne sait pas faire :/

@@ -29,18 +31,6 @@
]


def query_stocks(ts_query):
Copy link
Contributor

Choose a reason for hiding this comment

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

pourquoi on l'a enlevé ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Parce que c'était inutilisé il me semble

raise ApiErrors({'offerId': ['Ce paramètre est obligatoire']})


def check_new_stock_has_dates(request_data: dict, offer: Offer):
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 convaincue par le nommage : vu les autres fonctions qu'on a nommées ainsi, on s'attend à avoir une erreur si le stock n'a pas de date, alors que ce n'est pas le cas. Proposition : check_new_stock_has_dates_or_is_thing

Copy link
Contributor

Choose a reason for hiding this comment

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

ce que je comprends c'est un truc du genre check_if_stock_can_have_dates ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Selon moi check_new_stock_has_dates est une intention. Le fait que ça ne lève pas d'erreur dans le cas d'une Thing est un cas particulier de cette règle mais qui respecte l'intention.

  • @sofcalca dans ta proposition on fait apparaître le cas particulier dans le nom, je ne suis pas pour ça parce qu'avec ce système de nommage on ne manipule plus des abstractions / intentions mais des détails d'implémentation
  • @annemarie35 dans le fond ta proposition me convient mais son utilisation donnerait : if check_if_stock_can_have_dates(...): et je trouve que ça se lit moyennement bien

Copy link
Contributor

Choose a reason for hiding this comment

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

et un check_stock_can_have_dates ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Vu avec Sofia : on prend check_dates_are_allowed_on_new_stock

stock_queries.save_stock(new_stock)
return jsonify(new_stock._asdict()), 201


# TODO: Si changement d'horaires et qu'il y a des réservations il faut envoyer des mails !
# TODO: Interdire la modification d'évenements passés
Copy link
Contributor

Choose a reason for hiding this comment

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

plutôt en faire des tickets non ? Pas super fan des todo dans le code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

En effet on a récupéré les TODO d'un autre module sans se poser la question.
@nfournier tu peux checker si on a toujours ces besoins ?

validation/stocks.py Outdated Show resolved Hide resolved
tests/routes/recommendations_test.py Show resolved Hide resolved

@clean_database
@pytest.mark.standalone
def test_route_delete_event_occurrence_deletes_event_occurrence_stocks_and_cancels_bookings(app):
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 tests dans ce sens dans stocks : il faudrait probablement les rajouter pour tester que les réservations sont bien annulées

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 rajoute ça

@abel-andre abel-andre force-pushed the PC-1647-merge-event-occurrence-into-stock branch from fccb0c7 to b619640 Compare March 21, 2019 14:33
@@ -11,7 +11,7 @@

@clean_database
@pytest.mark.standalone
def skip_test_get_keywords_analyzer(app):
def test_get_keywords_analyzer(app):
Copy link
Contributor

Choose a reason for hiding this comment

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

il me semble très étrange ce test... il ne serait pas mieux de le supprimer ?

@abel-andre abel-andre force-pushed the PC-1647-merge-event-occurrence-into-stock branch from 2ca98ad to 1c9193e Compare March 25, 2019 09:03
@sofcalca sofcalca force-pushed the PC-1647-merge-event-occurrence-into-stock branch 2 times, most recently from ac98dbe to a50dfc1 Compare March 26, 2019 15:46
@abel-andre abel-andre force-pushed the PC-1647-merge-event-occurrence-into-stock branch from a50dfc1 to 41e5166 Compare March 27, 2019 13:42
@abel-andre abel-andre force-pushed the PC-1647-merge-event-occurrence-into-stock branch from 472da77 to 24ce3fc Compare March 28, 2019 11:27
@Ledoux Ledoux self-requested a review March 28, 2019 17:06
@Ledoux Ledoux merged commit eefddce into master Mar 28, 2019
@edupedup edupedup deleted the PC-1647-merge-event-occurrence-into-stock branch June 17, 2019 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants