Skip to content

Commit

Permalink
Add remove_country function
Browse files Browse the repository at this point in the history
  • Loading branch information
Lekuruu authored Dec 18, 2023
1 parent b35d189 commit 990ce5b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cache/leaderboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,37 @@ def update(stats: DBStats, country: str) -> None:
{stats.user_id: stats.acc}
)

def remove_country(
user_id: int,
country: str
) -> None:
"""Remove player from country leaderboards"""
for mode in range(4):
app.session.redis.zrem(
f'bancho:performance:{mode}:{country.lower()}',
user_id
)

app.session.redis.zrem(
f'bancho:rscore:{mode}:{country.lower()}',
user_id
)

app.session.redis.zrem(
f'bancho:tscore:{mode}:{country.lower()}',
user_id
)

app.session.redis.zrem(
f'bancho:ppv1:{mode}:{country.lower()}',
user_id
)

app.session.redis.zrem(
f'bancho:acc:{mode}:{country.lower()}',
user_id
)

def remove(
user_id: int,
country: str
Expand Down

0 comments on commit 990ce5b

Please sign in to comment.