mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 10:05:21 +00:00
jira-15 leader board API and profile API
This commit is contained in:
@ -120,7 +120,7 @@ class CreateGuardianSerializer(serializers.ModelSerializer):
|
||||
image_url = upload_image_to_alibaba(image, filename)
|
||||
guardian.image = image_url
|
||||
"""Complete profile of the junior if below all data are filled"""
|
||||
complete_profile_field = all([guardian.phone, guardian.gender, guardian.family_name, guardian.country_name,
|
||||
complete_profile_field = all([guardian.phone, guardian.gender, guardian.country_name,
|
||||
guardian.dob, guardian.country_code, user.first_name, user.last_name,
|
||||
user.email, guardian.image])
|
||||
guardian.is_complete_profile = False
|
||||
@ -188,18 +188,18 @@ class TaskDetailsSerializer(serializers.ModelSerializer):
|
||||
class TopJuniorSerializer(serializers.ModelSerializer):
|
||||
"""Top junior serializer"""
|
||||
junior = JuniorDetailSerializer()
|
||||
position = serializers.SerializerMethodField()
|
||||
position = serializers.IntegerField()
|
||||
|
||||
class Meta(object):
|
||||
class Meta:
|
||||
"""Meta info"""
|
||||
model = JuniorPoints
|
||||
fields = ['id', 'junior', 'total_task_points', 'position', 'created_at', 'updated_at']
|
||||
|
||||
def get_position(self, obj):
|
||||
"""get position of junior"""
|
||||
queryset = self.context['view'].get_queryset()
|
||||
position = list(queryset).index(obj) + 1
|
||||
return position
|
||||
def to_representation(self, instance):
|
||||
"""Convert instance to representation"""
|
||||
representation = super().to_representation(instance)
|
||||
representation['position'] = instance.position
|
||||
return representation
|
||||
|
||||
|
||||
class GuardianProfileSerializer(serializers.ModelSerializer):
|
||||
|
Reference in New Issue
Block a user