Working leaderboard
This commit is contained in:
@@ -1,194 +1,17 @@
|
||||
"use server";
|
||||
|
||||
import { createClient } from "@/lib/supabase/server";
|
||||
import * as Core from "./core";
|
||||
import { LeaderboardRank } from "./types"; // updated interface
|
||||
import { LeaderboardUser } from "./types"; // updated interface
|
||||
|
||||
export async function getGlobalLeaderboard(): Promise<LeaderboardRank[]> {
|
||||
return [
|
||||
{
|
||||
rank: 1,
|
||||
username: "speedmaster_x",
|
||||
pb: "2:34.21",
|
||||
runsCount: 2341,
|
||||
problem: "Fix broken login flow",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 2,
|
||||
username: "algo_ninja",
|
||||
pb: "2:38.54",
|
||||
runsCount: 1876,
|
||||
problem: "Refactor legacy API endpoints",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 3,
|
||||
username: "clockwork",
|
||||
pb: "2:41.02",
|
||||
runsCount: 3102,
|
||||
problem: "Optimize image upload pipeline",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 4,
|
||||
username: "fastfingers99",
|
||||
pb: "2:45.33",
|
||||
runsCount: 987,
|
||||
problem: "Build a mini chat server",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 5,
|
||||
username: "recursion_queen",
|
||||
pb: "2:47.89",
|
||||
runsCount: 1543,
|
||||
problem: "Fix CSS layout bug in dashboard",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 6,
|
||||
username: "bitshifter",
|
||||
pb: "2:52.11",
|
||||
runsCount: 2109,
|
||||
problem: "Implement JWT authentication",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 7,
|
||||
username: "nullpointer",
|
||||
pb: "2:54.67",
|
||||
runsCount: 876,
|
||||
problem: "Create REST endpoint for user data",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 8,
|
||||
username: "stackattack",
|
||||
pb: "2:58.23",
|
||||
runsCount: 1234,
|
||||
problem: "Fix off-by-one bug in sorting function",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 9,
|
||||
username: "looplegend",
|
||||
pb: "3:01.45",
|
||||
runsCount: 654,
|
||||
problem: "Optimize SQL query for reports",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 10,
|
||||
username: "coderunner",
|
||||
pb: "3:05.78",
|
||||
runsCount: 1098,
|
||||
problem: "Add file upload validation",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
];
|
||||
export async function getGlobalLeaderboard(): Promise<LeaderboardUser[]> {
|
||||
const supabase = await createClient();
|
||||
|
||||
return await Core.getGlobalLeaderboard(supabase);
|
||||
}
|
||||
|
||||
export async function getWeeklyLeaderboard(): Promise<LeaderboardRank[]> {
|
||||
return [
|
||||
{
|
||||
rank: 1,
|
||||
username: "weekly_warrior",
|
||||
pb: "2:51.33",
|
||||
runsCount: 156,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 2,
|
||||
username: "speedmaster_x",
|
||||
pb: "2:53.12",
|
||||
runsCount: 89,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 3,
|
||||
username: "newbie_grinder",
|
||||
pb: "2:58.67",
|
||||
runsCount: 234,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 4,
|
||||
username: "algo_ninja",
|
||||
pb: "3:02.45",
|
||||
runsCount: 67,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 5,
|
||||
username: "fresh_runner",
|
||||
pb: "3:05.89",
|
||||
runsCount: 45,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 6,
|
||||
username: "practice_makes",
|
||||
pb: "3:08.12",
|
||||
runsCount: 112,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 7,
|
||||
username: "splitmaster",
|
||||
pb: "3:12.34",
|
||||
runsCount: 78,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 8,
|
||||
username: "grindtime",
|
||||
pb: "3:15.56",
|
||||
runsCount: 92,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 9,
|
||||
username: "pb_hunter",
|
||||
pb: "3:18.90",
|
||||
runsCount: 56,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
{
|
||||
rank: 10,
|
||||
username: "reset_king",
|
||||
pb: "3:22.11",
|
||||
runsCount: 187,
|
||||
problem: "Build notifications API",
|
||||
category: "any%",
|
||||
assisted: false,
|
||||
},
|
||||
];
|
||||
export async function getWeeklyLeaderboard(): Promise<LeaderboardUser[]> {
|
||||
const supabase = await createClient();
|
||||
|
||||
return await Core.getWeeklyLeaderboard(supabase);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user