sonar fixes

This commit is contained in:
jain
2023-07-10 12:10:15 +05:30
parent 3098de36b8
commit 026bfb6da7
14 changed files with 94 additions and 51 deletions

View File

@ -89,16 +89,17 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
junior.phone = validated_data.get('phone', junior.phone)
junior.country_code = validated_data.get('country_code', junior.country_code)
junior.referral_code_used = validated_data.get('referral_code_used', junior.referral_code_used)
"""Complete profile of the junior if below all data are filled"""
complete_profile_field = all([junior.phone, junior.gender, junior.country_name,
junior.dob, junior.country_code, user.first_name, user.last_name])
junior.is_complete_profile = False
if complete_profile_field:
junior.is_complete_profile = True
if image:
filename = f"images/{image.name}"
image_url = upload_image_to_alibaba(image, filename)
junior.image = image_url
"""Complete profile of the junior if below all data are filled"""
complete_profile_field = all([junior.phone, junior.gender, junior.country_name, junior.image,
junior.dob, junior.country_code, user.first_name, user.last_name,
user.email])
junior.is_complete_profile = False
if complete_profile_field:
junior.is_complete_profile = True
junior.save()
return junior