diff --git a/polylan_submitter/animations/schemas.py b/polylan_submitter/animations/schemas.py index d064bc6..a4d14f2 100644 --- a/polylan_submitter/animations/schemas.py +++ b/polylan_submitter/animations/schemas.py @@ -33,6 +33,7 @@ class PuzzleResponseRankingOut(ModelSchema): class UserDisplayOut(Schema): id: int username: str + is_staff: bool class RankingSchema(Schema): diff --git a/polylan_submitter/noita/api.py b/polylan_submitter/noita/api.py index a18367f..70047ec 100644 --- a/polylan_submitter/noita/api.py +++ b/polylan_submitter/noita/api.py @@ -195,7 +195,7 @@ def get_leaderboard(request: HttpRequest): users_with_scores.append( { "user_id": user_id, - "username": user.username, + "user": user, "total_score": total_score, "objectives_count": objectives_count, "deaths_count": deaths_count, @@ -207,7 +207,8 @@ def get_leaderboard(request: HttpRequest): leaderboard = [ { "rank": idx + 1, - "username": entry["username"], + "username": entry["user"].username, + "is_staff": entry["user"].is_staff, "total_score": entry["total_score"], "objectives_count": entry["objectives_count"], "deaths_count": entry["deaths_count"], diff --git a/polylan_submitter/noita/schemas.py b/polylan_submitter/noita/schemas.py index 738ab86..747e8bd 100644 --- a/polylan_submitter/noita/schemas.py +++ b/polylan_submitter/noita/schemas.py @@ -30,6 +30,7 @@ class ResultsOut(Schema): class LeaderboardEntryOut(Schema): rank: int username: str + is_staff: bool total_score: int objectives_count: int deaths_count: int diff --git a/polylan_submitter/src/Noita.vue b/polylan_submitter/src/Noita.vue index a43a8c5..438f1ef 100644 --- a/polylan_submitter/src/Noita.vue +++ b/polylan_submitter/src/Noita.vue @@ -365,6 +365,9 @@ onMounted(() => { You + + admin + {{ entry.total_score.toLocaleString() }} diff --git a/polylan_submitter/src/components/Results.vue b/polylan_submitter/src/components/Results.vue index d645441..34a4cbe 100644 --- a/polylan_submitter/src/components/Results.vue +++ b/polylan_submitter/src/components/Results.vue @@ -5,6 +5,7 @@ import RankBadge from "./RankBadge.vue"; interface User { id: number; username: string; + is_staff: boolean, first_name?: string; last_name?: string; } @@ -84,7 +85,7 @@ const getOverallRanking = () => { const count = responses.length; return { - username: user.username, + user: user, totalPoints, puzzlesSolved: count, }; @@ -98,9 +99,9 @@ const getPuzzleRanking = (puzzleId: number) => { const ranking = resultsData.value.ranking_by_puzzle[puzzleId] || []; return ranking.map((response) => { - const user = resultsData.value!.users.find((u) => u.id === response.user_id); + const user = resultsData.value!.users.find((u) => u.id === response.user_id) as User; return { - username: user?.username || "Unknown", + user: user, cost: response.final_cost, cycles: response.final_cycles, area: response.final_area, @@ -146,7 +147,7 @@ const loadUserData = async () => { // Calculate user's rank and stats const ranking = getOverallRanking(); - const userRankIndex = ranking.findIndex((u) => u.username === user.username); + const userRankIndex = ranking.findIndex((u) => u.user.id === user.id); if (userRankIndex !== -1) { userInfo.value.rank = userRankIndex + 1; @@ -235,7 +236,7 @@ onMounted(() => {
-
+