mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-16 10:26:16 +00:00
fixed add junior multiple device notification issue, changed send multiple user notification method, modified add fcm token method
This commit is contained in:
@ -9,7 +9,7 @@ from django.contrib.auth import get_user_model
|
||||
|
||||
from account.utils import get_user_full_name
|
||||
# local imports
|
||||
from base.constants import USER_TYPE
|
||||
from base.constants import USER_TYPE, JUNIOR
|
||||
|
||||
from junior.models import JuniorPoints, Junior
|
||||
|
||||
@ -37,7 +37,7 @@ class JuniorLeaderboardSerializer(serializers.ModelSerializer):
|
||||
:param obj: junior object
|
||||
:return: full name
|
||||
"""
|
||||
return f"{obj.auth.first_name} {obj.auth.last_name}" if obj.auth.last_name else obj.auth.first_name
|
||||
return get_user_full_name(obj.auth)
|
||||
|
||||
@staticmethod
|
||||
def get_first_name(obj):
|
||||
@ -60,6 +60,8 @@ class LeaderboardSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
leaderboard serializer
|
||||
"""
|
||||
user_id = serializers.SerializerMethodField()
|
||||
user_type = serializers.SerializerMethodField()
|
||||
junior = JuniorLeaderboardSerializer()
|
||||
rank = serializers.IntegerField()
|
||||
|
||||
@ -68,7 +70,15 @@ class LeaderboardSerializer(serializers.ModelSerializer):
|
||||
meta class
|
||||
"""
|
||||
model = JuniorPoints
|
||||
fields = ('total_points', 'rank', 'junior')
|
||||
fields = ('user_id', 'user_type', 'total_points', 'rank', 'junior')
|
||||
|
||||
@staticmethod
|
||||
def get_user_id(obj):
|
||||
return obj.junior.auth.id
|
||||
|
||||
@staticmethod
|
||||
def get_user_type(obj):
|
||||
return JUNIOR
|
||||
|
||||
|
||||
class UserCSVReportSerializer(serializers.ModelSerializer):
|
||||
|
Reference in New Issue
Block a user