-
Notifications
You must be signed in to change notification settings - Fork 7
Pc 1647 merge event occurrence into stock #491
Conversation
ea3b373
to
9453a62
Compare
self.eventOccurrences))) | ||
else: | ||
return [] | ||
|
||
@property | ||
def lastStock(self): | ||
query = Stock.queryNotSoftDeleted() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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é ?
There was a problem hiding this comment.
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
validation/stocks.py
Outdated
raise ApiErrors({'offerId': ['Ce paramètre est obligatoire']}) | ||
|
||
|
||
def check_new_stock_has_dates(request_data: dict, offer: Offer): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?
sandboxes/scripts/creators/industrial/create_industrial_bookings.py
Outdated
Show resolved
Hide resolved
|
||
@clean_database | ||
@pytest.mark.standalone | ||
def test_route_delete_event_occurrence_deletes_event_occurrence_stocks_and_cancels_bookings(app): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je rajoute ça
fccb0c7
to
b619640
Compare
@@ -11,7 +11,7 @@ | |||
|
|||
@clean_database | |||
@pytest.mark.standalone | |||
def skip_test_get_keywords_analyzer(app): | |||
def test_get_keywords_analyzer(app): |
There was a problem hiding this comment.
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 ?
2ca98ad
to
1c9193e
Compare
ac98dbe
to
a50dfc1
Compare
a50dfc1
to
41e5166
Compare
472da77
to
24ce3fc
Compare
No description provided.