Edit rating/points rank of unlisted users and cache get_rank functions

This commit is contained in:
anhkha2003 2024-06-04 19:38:48 -05:00
parent d9800a4759
commit 0803610811
6 changed files with 18 additions and 8 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,