fix(opus): wrong frontend ordering points -> rank-points

This commit is contained in:
Loïc Gremaud 2026-05-15 03:05:33 +02:00
parent 3e04f8312a
commit 779393106d
Signed by: Legrems
GPG Key ID: D4620E6DF3E0121D
2 changed files with 156 additions and 174 deletions

View File

@ -126,17 +126,10 @@ const goHome = () => {
<h1 class="text-xl font-bold">Opus Magnum Puzzle Submitter</h1>
<div class="flex-1"></div>
<div class="flex items-center gap-4">
<div
v-if="userInfo?.is_authenticated"
class="flex items-center gap-2"
>
<div v-if="userInfo?.is_authenticated" class="flex items-center gap-2">
<div class="text-sm">
<span class="font-medium">{{ userInfo.username }}</span>
<span
v-if="userInfo.is_superuser"
class="badge badge-warning badge-xs ml-1"
>Admin</span
>
<span v-if="userInfo.is_superuser" class="badge badge-warning badge-xs ml-1">Admin</span>
</div>
</div>
<div v-else class="text-sm text-base-content/70">Not logged in</div>
@ -158,10 +151,7 @@ const goHome = () => {
</div>
</div>
<div
v-if="isLoading"
class="flex justify-center items-center min-h-[400px]"
>
<div v-if="isLoading" class="flex justify-center items-center min-h-[400px]">
<div class="text-center">
<span class="loading loading-spinner loading-lg"></span>
<p class="mt-4 text-base-content/70">Loading puzzles...</p>
@ -210,12 +200,8 @@ const goHome = () => {
<!-- Puzzles Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<PuzzleCard
v-for="puzzle in puzzlesStore.puzzles"
:key="puzzle.id"
:puzzle="puzzle"
:responses="responsesByPuzzle[puzzle.id] || []"
/>
<PuzzleCard v-for="puzzle in puzzlesStore.puzzles" :key="puzzle.id" :puzzle="puzzle"
:responses="responsesByPuzzle[puzzle.id] || []" />
</div>
<!-- Empty State -->
@ -234,18 +220,12 @@ const goHome = () => {
<div class="modal-box max-w-6xl">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-lg">Submit Solution</h3>
<button
@click="closeSubmissionModal"
class="btn btn-sm btn-circle btn-ghost"
>
<button @click="closeSubmissionModal" class="btn btn-sm btn-circle btn-ghost">
<i class="mdi mdi-close"></i>
</button>
</div>
<SubmissionForm
:puzzles="puzzlesStore.puzzles"
:find-puzzle-by-name="findPuzzleByName"
/>
<SubmissionForm :puzzles="puzzlesStore.puzzles" :find-puzzle-by-name="findPuzzleByName" />
</div>
<div class="modal-backdrop" @click="closeSubmissionModal"></div>
</div>

View File

@ -101,7 +101,7 @@ const getPuzzleRanking = (puzzleId: number) => {
points: response.points,
rank_points: response.rank_points || 0,
};
});
}).reverse();
};
const togglePuzzleExpanded = (puzzleId: number) => {
@ -186,7 +186,7 @@ onMounted(() => {
<div class="text-center">
<p class="text-sm text-base-content/70 mb-1">Current Rank</p>
<p v-if="userInfo.rank !== null" class="text-4xl font-bold text-primary">
#{{ userInfo.rank }}
<RankBadge :rank="userInfo.rank" />
</p>
<p v-else class="text-2xl text-base-content/50">No rank yet</p>
</div>
@ -278,10 +278,12 @@ onMounted(() => {
<!-- By Puzzle Ranking -->
<div v-show="selectedTab === 'byPuzzle'" class="space-y-6">
<div v-for="puzzle in resultsData.puzzles" :key="puzzle.id" class="card bg-base-100 border border-base-300">
<div v-for="puzzle in resultsData.puzzles" :key="puzzle.id"
class="card bg-base-100 border border-base-300">
<button @click="togglePuzzleExpanded(puzzle.id)"
class="btn btn-ghost btn-lg w-full justify-start text-lg font-bold hover:bg-primary/20 rounded-b-none">
<i :class="['mdi mr-2', expandedPuzzleId === puzzle.id ? 'mdi-chevron-down' : 'mdi-chevron-right']"></i>
<i
:class="['mdi mr-2', expandedPuzzleId === puzzle.id ? 'mdi-chevron-down' : 'mdi-chevron-right']"></i>
{{ puzzle.title }}
<span class="ml-auto badge badge-sm">
{{ getPuzzleRanking(puzzle.id).length }} submissions