Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
FOSSit#1 problem solved
  • Loading branch information
Vish2802 authored Apr 14, 2024
1 parent 4c43e3d commit afdeb58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/routes/leaderboard/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
// REMEMBER TO CACHE JSON
let teams = true;
let loading = true;
async function loadTeams() {
// loading = true;
const { data, error } = await supabase.from('leaderboard').select('name, points');
if (error) console.log('Error Fetching Teams:', error.message);
if (data.length) leaderboard = data;
sortleaderboard()
loading = false;
}
Expand All @@ -26,9 +27,11 @@
const { data, error } = await supabase.from('ideas').select('title, votes, url');
if (error) console.log('Error Fetching Ideas:', error.message);
if (data.length) leaderboard = data;
sortleaderboard()
loading = false;
}
function sortLeaderboard() {
leaderboard.sort((a, b) => a.points - b.points);
onMount(async () => {
loadTeams();
resize();
Expand Down

0 comments on commit afdeb58

Please sign in to comment.