From ecf96791fd7fdd7b3d6e56a1a1284df0938bd3bc Mon Sep 17 00:00:00 2001 From: Yoan Le Clanche Date: Tue, 19 Jan 2021 18:03:39 +0100 Subject: [PATCH] Fix issue finding appropriate cart --- .../management/commands/teleforma-export-avis.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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) -- 2.39.5