Edit displaying rating and points rank for unlisted (#115)

* Edit displaying rating and points rank for unlisted

* Edit rating/points rank of unlisted users and cache get_rank functions
This commit is contained in:
Phuoc Anh Kha Le 2024-06-04 19:40:20 -05:00 committed by GitHub
parent 570c3071ee
commit 46c950dc37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 25 additions and 19 deletions

View file

@ -6,7 +6,10 @@ from judge.caching import cache_wrapper
from judge.models import Profile, Rating, Submission, Friend, ProfileInfo
@cache_wrapper(prefix="grr")
def get_rating_rank(profile):
if profile.is_unlisted:
return None
rank = None
if profile.rating:
rank = (
@ -19,7 +22,10 @@ def get_rating_rank(profile):
return rank
@cache_wrapper(prefix="gpr")
def get_points_rank(profile):
if profile.is_unlisted:
return None
return (
Profile.objects.filter(
is_unlisted=False,