Skip to content

Commit

Permalink
chore: quick fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Type-32 <[email protected]>
  • Loading branch information
Type-32 committed Oct 2, 2024
1 parent 00c5437 commit e222697
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 28 deletions.
Binary file added app/assets/images/rela4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const links = [
icon: 'i-lucide-info',
children: [
{
label: 'Articles',
label: 'More Than a Game',
icon: 'i-lucide-newspaper',
to: '/articles',
description: 'Our articles that records matches, fun facts, and more information regarding the sport of Frisbee.'
Expand All @@ -21,9 +21,9 @@ const links = [
description: 'The matches we have hosted in this league.'
},
{
label: 'Tables',
label: 'Standings',
icon: 'i-lucide-users',
to: `/tables`,
to: `/standings`,
description: 'The statistics of the teams in this league. Updated Real-time.'
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/pages/articles/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function parseAndFormatDate(dateString: string): string {
<UContainer>
<UPage>
<UPageHeader
title="Articles"
title="More Than a Game"
description="A section of where we post content related to the organization."
/>
<UPageBody class="w-full h-full flex flex-col gap-5 items-center">
Expand Down
23 changes: 9 additions & 14 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ const items = [
img9,
img10,
img11,
img12,
img13
img12
]
const landingItems = [
Expand Down Expand Up @@ -135,9 +134,7 @@ onMounted(() => {
<MainLayout>
<div class="flex flex-col gap-20">
<LandingSection class="min-h-screen items-center justify-center align-middle">
<div class="">
<span class="font-bold text-7xl text-pretty text-center text-transparent bg-gradient-to-r from-cyan-400 to-blue-700 bg-clip-text fade-in-from-top">SHUL is Back</span>
</div>
<span class="font-bold text-7xl text-pretty text-center text-transparent bg-primary bg-clip-text fade-in-from-top">SHUL is Back</span>
<div class="flex flex-col items-center justify-center">
<img src="~/assets/cap.png" class="object-contain size-96 hover:scale-105 active:scale-95 duration-200 hover:cursor-pointer" alt="billed cap"/>
<span class="text-center w-full fade-in-from-bottom">...with our first-ever hat.</span>
Expand All @@ -146,14 +143,12 @@ onMounted(() => {
<LandingSection>
<ULandingHero
icon="i-lucide-rocket"
title="South China's Largest High School Ultimate Frisbee League"
title="South China's Largest Ultimate Frisbee League"
description="A platform for organized competition between south China high schools and improve opportunities for female high school students in China to do sports."
>
<UCard>
<UCarousel ref="carouselRef" indicators :items="items" v-slot="{item}" class="w-full">
<div class="h-[90svh] items-center flex justify-center relative overflow-hidden">
<img :src="item" alt="img" class="h-full object-cover"/>
</div>
<img :src="item" alt="img" class="w-full object-cover container"/>
</UCarousel>
</UCard>
</ULandingHero>
Expand Down Expand Up @@ -186,18 +181,18 @@ onMounted(() => {
</LandingSection>
<UDivider/>
<LandingSection>
<div class="font-bold text-center text-3xl">Sponsorship</div>
<div class="font-bold text-center text-3xl">Partners & Sponsors</div>
<div class="items-center justify-center w-full grid grid-cols-3 gap-20">
<div class="w-full flex flex-col items-center gap-5">
<img class="object-contain w-full" src="~/assets/images/rela1.png" alt="1"/>
<span>The World Flying Disc Federation (WFDF) is the international governing body for flying disc
sports, including Ultimate and Disc Golf.</span>
</div>
<div class="w-full flex flex-col items-center gap-5">
<img class="object-contain w-full" src="~/assets/images/rela2.png" alt="2"/>
<span>USA Ultimate is the governing body for the sport of ultimate frisbee in the United States.
Founded in 1979, it organizes competitions and promotes the sport at various levels,
including youth, college, and club divisions.</span>
<img class="object-contain w-full h-48" src="~/assets/images/rela4.jpg" alt="2"/>
<span>The Shenzhen Flying Disc Association (SFDA) is a prominent organization dedicated to promoting
flying disc sports, particularly Ultimate Frisbee, within Shenzhen, China. Established in 2013,
the SFDA plays a crucial role in fostering a vibrant community of enthusiasts and athletes.</span>
</div>
<div class="w-full flex flex-col items-center gap-5">
<img class="object-contain w-full" src="~/assets/images/rela3.png" alt="3"/>
Expand Down
2 changes: 1 addition & 1 deletion app/pages/matches.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function parseAndFormatDate(dateString: string): string {
description="A list of all of our past matches."
/>
<UPageBody>
<div class="grid grid-cols-2 tablet:grid-cols-1">
<div class="grid desktop:grid-cols-2 grid-cols-1 gap-5">
<UCard v-for="(match, index) in matches" :key="index">
<template #header>
<div class="grid grid-cols-3">
Expand Down
2 changes: 1 addition & 1 deletion app/pages/tables.vue → app/pages/standings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function parseAndFormatDate(dateString: string): string {
<UContainer>
<UPage>
<UPageHeader
title="Leagues"
title="Standings"
description="A place where all information of the teams are listed out in a formatted table."
/>
<UPageBody>
Expand Down
25 changes: 17 additions & 8 deletions server/api/v1/statistics.get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {PrismaClient} from "@prisma/client";
const prisma = new PrismaClient();

export default defineEventHandler(async (event) => {
const teams = await prisma.team.findMany({
include: {
Expand All @@ -8,21 +9,20 @@ export default defineEventHandler(async (event) => {
},
});

let rank = 1;
const teamStats = teams.map(team => {
const homeMatches = team.homeMatches;
const guestMatches = team.guestMatches;

const totalMatches = [...homeMatches, ...guestMatches];

let wins = 0;
let draws = 0;
let loses = 0;
let totalPoints = 0;
let wins: number = 0;
let draws: number = 0;
let loses: number = 0;
let totalPoints: number = 0;

totalMatches.forEach(match => {
if (match.homeTeamId === team.id) {
totalPoints += match.home_score;
totalPoints += parseInt(match.home_score as any as string);
if (match.home_score > match.guest_score) {
wins++;
} else if (match.home_score < match.guest_score) {
Expand All @@ -31,7 +31,7 @@ export default defineEventHandler(async (event) => {
draws++;
}
} else if (match.guestTeamId === team.id) {
totalPoints += match.guest_score;
totalPoints += parseInt(match.guest_score as any as string);
if (match.guest_score > match.home_score) {
wins++;
} else if (match.guest_score < match.home_score) {
Expand All @@ -48,9 +48,18 @@ export default defineEventHandler(async (event) => {
draws,
loses,
totalPoints,
rank: rank++
rank: 0
};
});

teamStats.sort((a, b) => {
return b.totalPoints - a.totalPoints; // Descending order
});

// Assign ranks after sorting
teamStats.forEach((team, index) => {
team.rank = index + 1;
});

return teamStats;
})

0 comments on commit e222697

Please sign in to comment.