trying to add score updates
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
import { db } from '$lib/server/db';
|
||||
import * as schema from '$lib/server/db/schema';
|
||||
|
||||
export class House {
|
||||
name: string = '';
|
||||
color: string = 'white';
|
||||
points: number = $state(0);
|
||||
}
|
||||
import type { Actions } from './$types';
|
||||
|
||||
export const load = async () => {
|
||||
return await getTeams();
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
addEntry: async (event) => {
|
||||
console.log('something');
|
||||
}
|
||||
} satisfies Actions;
|
||||
|
||||
let testScore = 0;
|
||||
|
||||
export async function getTeams() {
|
||||
const allTeams = await db.select().from(schema.teamScoresView);
|
||||
console.log(allTeams);
|
||||
return {
|
||||
@@ -15,7 +22,7 @@ export const load = async () => {
|
||||
...team,
|
||||
name: team.teamName,
|
||||
color: team.teamColor,
|
||||
points: team.totalPoints || 0
|
||||
points: team.totalPoints || testScore
|
||||
}))
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
import { enhance } from '$app/forms';
|
||||
let { data }: { data: import('./$types').PageData } = $props();
|
||||
|
||||
let leaderboard = $derived([...data.teams].sort((a, b) => b.points - a.points));
|
||||
@@ -19,6 +19,8 @@
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<form method="POST" action="?/addEntry" use:enhance><button>click</button></form>
|
||||
|
||||
<style>
|
||||
@import url('https://cdn.jsdelivr.net/npm/@catppuccin/palette/css/catppuccin.css');
|
||||
.score-box {
|
||||
|
||||
Reference in New Issue
Block a user