mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 16:44:54 +00:00
changes in complete profile field
This commit is contained in:
@ -12,7 +12,7 @@ from account.utils import send_otp_email
|
||||
from junior.models import Junior, JuniorPoints
|
||||
from guardian.tasks import generate_otp
|
||||
from base.messages import ERROR_CODE, SUCCESS_CODE
|
||||
from base.constants import PENDING, IN_PROGRESS, REJECTED, REQUESTED, COMPLETED
|
||||
from base.constants import PENDING, IN_PROGRESS, REJECTED, REQUESTED, COMPLETED, NUMBER
|
||||
from guardian.models import Guardian, JuniorTask
|
||||
from account.models import UserEmailOtp
|
||||
from junior.utils import junior_notification_email, junior_approval_mail
|
||||
@ -98,9 +98,8 @@ class CreateJuniorSerializer(serializers.ModelSerializer):
|
||||
junior.referral_code_used = validated_data.get('referral_code_used', junior.referral_code_used)
|
||||
junior.image = validated_data.get('image', junior.image)
|
||||
"""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])
|
||||
complete_profile_field = all([junior.gender, junior.country_name, junior.image,
|
||||
junior.dob, user.first_name])
|
||||
junior.is_complete_profile = False
|
||||
if complete_profile_field:
|
||||
junior.is_complete_profile = True
|
||||
@ -231,12 +230,12 @@ class JuniorProfileSerializer(serializers.ModelSerializer):
|
||||
|
||||
def get_total_count(self, obj):
|
||||
"""total fields count"""
|
||||
return 9
|
||||
return NUMBER['five']
|
||||
|
||||
def get_complete_field_count(self, obj):
|
||||
"""total filled fields count"""
|
||||
field_list = [obj.auth.first_name, obj.auth.last_name, obj.auth.email, obj.country_name, obj.country_code,
|
||||
obj.phone, obj.gender, obj.dob, obj.image]
|
||||
field_list = [obj.auth.first_name, obj.country_name,
|
||||
obj.gender, obj.dob, obj.image]
|
||||
complete_field = [data for data in field_list if data is not None and data != '']
|
||||
return len(complete_field)
|
||||
class Meta(object):
|
||||
|
||||
Reference in New Issue
Block a user