From 6e76925ac9a6071a4a295d9dfdc835b2a779a1ad Mon Sep 17 00:00:00 2001 From: Gael Le Mignot Date: Thu, 15 Apr 2021 11:45:46 +0200 Subject: [PATCH] Bug fix in XLS export of students --- teleforma/views/crfpa.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index d438ec07..3aa08f6b 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -319,7 +319,12 @@ class UserXLSBook(object): value = payment['value'] month = payment['month'] ptype = payment['type'] - ptype_label = next((payment_choice[1] for payment_choice in payment_choices if payment_choice[0] == ptype), ['none']) + for payment_choice in payment_choices: + if payment_choice[0] == ptype: + ptype_label = payment_choice[1] + break + else: + ptype_label = 'none' total_payments += value if month in payment_per_month: payment_per_month[month]['amount'] += value -- 2.39.5