task points

This commit is contained in:
jain
2023-08-10 19:00:37 +05:30
parent 22afe7e555
commit 11c84208b7

View File

@ -184,8 +184,10 @@ class JuniorDetailListSerializer(serializers.ModelSerializer):
return data.position
return 99999
def get_points(self, obj):
data = sum(JuniorTask.objects.filter(junior=obj, task_status=COMPLETED).values_list('points', flat=True))
return data
data = JuniorPoints.objects.filter(junior=obj).last()
if data:
return data.total_points
return NUMBER['zero']
def get_in_progress_task(self, obj):
data = JuniorTask.objects.filter(junior=obj, task_status=IN_PROGRESS).count()
@ -210,7 +212,7 @@ class JuniorDetailListSerializer(serializers.ModelSerializer):
class Meta(object):
"""Meta info"""
model = Junior
fields = ['id', 'email', 'first_name', 'last_name', 'country_code', 'phone', 'gender', 'dob',
fields = ['id', 'email', 'first_name', 'last_name', 'country_code', 'country_name', 'phone', 'gender', 'dob',
'guardian_code', 'referral_code','is_active', 'is_complete_profile', 'created_at', 'image',
'updated_at', 'assigned_task','points', 'pending_task', 'in_progress_task', 'completed_task',
'requested_task', 'rejected_task', 'position', 'is_invited', 'guardian_code_status']