]> git.parisson.com Git - teleforma.git/commitdiff
Fix xls student export
authorYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 5 Dec 2023 08:21:00 +0000 (09:21 +0100)
committerYoan Le Clanche <yoanl@pilotsystems.net>
Tue, 5 Dec 2023 08:21:00 +0000 (09:21 +0100)
teleforma/views/crfpa.py

index e9568e530fbedb67e9a343dbc04931ae95774977..d410763f30aa76157de748ca7dd558434bd5c42b 100644 (file)
@@ -283,7 +283,7 @@ class UserXLSBook(object):
             row.write(0, user.last_name)
             row.write(1, user.first_name)
             row.write(2, student.portrait and student.portrait.url or '')
-            row.write(8, user.email)
+            
             row.write(3, str(student.iej))
 
             codes = []
@@ -293,37 +293,34 @@ class UserXLSBook(object):
                 else:
                     codes.append(training['code'])
             row.write(4, str(' '.join(codes)))
-
-            row.write(5, self.get_course_code(student.procedure_id))
-            row.write(6, self.get_course_code(student.written_speciality_id))
-            row.write(7, self.get_course_code(student.oral_1_id))
+            row.write(5, user.email)
 
             profile = Profile.objects.filter(user=user)
             if profile:
                 profile = profile[0]
-                row.write(9, profile.address)
-                row.write(10, profile.address_detail)
-                row.write(11, profile.postal_code)
-                row.write(12, profile.city)
-                row.write(13, profile.telephone)
+                row.write(6, profile.address)
+                row.write(7, profile.address_detail)
+                row.write(8, profile.postal_code)
+                row.write(9, profile.city)
+                row.write(10, profile.telephone)
                 if profile.birthday:
                     try:
-                        row.write(14, profile.birthday.strftime("%d/%m/%Y"))
+                        row.write(11, profile.birthday.strftime("%d/%m/%Y"))
                     except ValueError:
-                        row.write(14, 'erreur')
+                        row.write(11, 'erreur')
 
-                row.write(15, student.level)
+                row.write(12, student.level)
 
                 if student.date_subscribed:
-                    row.write(16, student.date_subscribed.strftime("%d/%m/%Y"))
+                    row.write(13, student.date_subscribed.strftime("%d/%m/%Y"))
 
             total_discount = 0
             descriptions = []
             for discount in student.discounts.values('value', 'description'):
                 total_discount -= discount['value']
                 descriptions.append(discount['description'])
-            row.write(17, total_discount)
-            row.write(18, ', '.join(descriptions))
+            row.write(14, total_discount)
+            row.write(15, ', '.join(descriptions))
 
             total_payments = 0
             payment_per_month = { month[0]: {'amount':0, 'type':set()} for month in months_choices }
@@ -340,17 +337,17 @@ class UserXLSBook(object):
                     payment_per_month[month]['amount'] += value
                     payment_per_month[month]['type'].add(ptype_label)
                 
-            row.write(19, total_payments)
+            row.write(16, total_payments)
 
-            row.write(20, student.total_fees)
-            row.write(21, student.balance)
-            row.write(22, student.total_paybacks)
+            row.write(17, student.total_fees)
+            row.write(18, student.balance)
+            row.write(19, student.total_paybacks)
 
-            row.write(23, student.subscription_fees)
-            row.write(24, student.fascicule)
+            row.write(20, student.subscription_fees)
+            row.write(21, student.fascicule)
                 
             
-            i = 25
+            i = 22
             for month in months_choices:
                 row.write(i, payment_per_month[month[0]]['amount'])
                 row.write(i+1, ','.join(payment_per_month[month[0]]['type']))
@@ -366,9 +363,6 @@ class UserXLSBook(object):
                 {'name': 'PHOTO', 'width': 7500},
                 {'name':'IEJ', 'width':2500},
                 {'name':'FORMATIONS', 'width':6000},
-                {'name':'PROC', 'width':2500},
-                {'name':'Ecrit Spe', 'width':3000},
-                {'name':'ORAL 1', 'width':3000},
                 {'name':'MAIL', 'width':7500},
                 {'name':'ADRESSE', 'width':7500},
                 {'name':'ADRESSE (suite)', 'width': 7500},