From: Yoan Le Clanche Date: Tue, 19 Jan 2021 17:03:39 +0000 (+0100) Subject: Fix issue finding appropriate cart X-Git-Tag: 2.8.1-pro~176 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=ecf96791fd7fdd7b3d6e56a1a1284df0938bd3bc;p=teleforma.git Fix issue finding appropriate cart --- diff --git a/teleforma/management/commands/teleforma-export-avis.py b/teleforma/management/commands/teleforma-export-avis.py index 2a70b131..c301d1b7 100644 --- a/teleforma/management/commands/teleforma-export-avis.py +++ b/teleforma/management/commands/teleforma-export-avis.py @@ -48,9 +48,9 @@ class Command(BaseCommand): cart = None if testimonial.seminar.course.code == "demo": continue - for cart in Cart.objects.filter(user=testimonial.user, status=Cart.STATE_PAYMENT_ACCEPTED).all(): - if cart.has_item(testimonial.seminar): - break + for some_cart in Cart.objects.filter(user=testimonial.user, status=Cart.STATE_PAYMENT_ACCEPTED).all(): + if some_cart.has_item(testimonial.seminar): + cart = some_cart if not cart: logging.warning("Can't find cart for testimonial %d" % testimonial.id) continue @@ -80,9 +80,9 @@ class Command(BaseCommand): for auditor in conference.auditor.all(): cart = None user = auditor.user - for cart in Cart.objects.filter(user=user, status=Cart.STATE_PAYMENT_ACCEPTED).all(): - if cart.has_item(conference): - break + for some_cart in Cart.objects.filter(user=user, status=Cart.STATE_PAYMENT_ACCEPTED).all(): + if some_cart.has_item(conference): + cart = some_cart if not cart: logging.warning("Can't find cart for conference %d" % conference.id)