Skip to content

Commit

Permalink
(BSR)[API] feat: load GooglePlacesInfo here to save a query later
Browse files Browse the repository at this point in the history
  • Loading branch information
thconte committed Apr 25, 2024
1 parent c8cc1a3 commit 3af8be5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions api/src/pcapi/routes/native/v1/offers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def get_offer(offer_id: str) -> serializers.OfferResponse:
.joinedload(Venue.managingOfferer)
.load_only(Offerer.name, Offerer.validationStatus, Offerer.isActive)
)
.options(joinedload(Offer.venue).joinedload(Venue.googlePlacesInfo))

This comment has been minimized.

Copy link
@dbaty

dbaty May 7, 2024

Contributor

@thconte : ce serait top d'ajouter un assert_num_queries dans un test de la route pour s'assurer qu'il n'y a pas de régression et qu'il n'y a pas d'autres requêtes SQL N+1 non détectées.

This comment has been minimized.

Copy link
@thconte

thconte May 7, 2024

Author Contributor

En effet tous les tests de cette route ont des assert_no_duplicated_queries mais pas de assert_num_queries. Ce sera rajouter :)

.options(joinedload(Offer.mediations))
.options(joinedload(Offer.product).load_only(Product.id, Product.thumbCount))
.outerjoin(Offer.lastProvider)
Expand Down

0 comments on commit 3af8be5

Please sign in to comment.