From: Guillaume Pellerin Date: Wed, 17 Mar 2021 17:02:38 +0000 (+0100) Subject: import: fix profile X-Git-Tag: 1.4.3~6 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e892b9afdc69d6f85014d6a0cdd539813db8fc50;p=teleforma.git import: fix profile --- diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index 17da029d..d438ec07 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -433,7 +433,6 @@ class UserXLSBook(object): if students: print(last_name.encode('utf8') + ' : updating') student = students[0] - profile = UserProfile(user=user) break if not student: @@ -446,12 +445,20 @@ class UserXLSBook(object): student = Student(user=user) student.save() + profiles = Profile.objects.filter(user=user) + if profiles: + profile = profiles[0] + else: + profile = Profile(user=user) + if 'I - ' in training: training = training.split(' - ')[1] student.platform_only = True student.trainings.add(Training.objects.get(code=training, period=period, platform_only=student.platform_only)) student.procedure = Course.objects.get(code=proc) student.written_speciality = Course.objects.get(code=spe) + if oral_1 == '': + oral_1 = 'X' student.oral_1 = Course.objects.get(code=oral_1) student.level = level student.period = period @@ -485,6 +492,8 @@ class UserXLSBook(object): if total_paybacks: payback = Payback(student=student, value=float(total_paybacks)) payback.save() + if subscription_fees == '': + subscription_fees = 0 student.subscription_fees = float(subscription_fees) student.fascicule = True if fascicule_sent else False student.restricted = True