diff --git a/src/routes/seasonpicks/+page.svelte b/src/routes/seasonpicks/+page.svelte index 0df751a..419bad6 100644 --- a/src/routes/seasonpicks/+page.svelte +++ b/src/routes/seasonpicks/+page.svelte @@ -76,7 +76,7 @@ .sort((a: Driver, b: Driver) => a.team.localeCompare(b.team)) : undefined} - + @@ -85,13 +85,13 @@
-
+

Hottake:

{data.seasonpick?.hottake}
-
+

Doohan Starts:

{#if data.seasonpick} @@ -101,7 +101,7 @@
-
+

WDC:

-
+

WCC:

-
+

Most Overtakes:

-
+

Most DNFs:

-
+

Teamwinners:

{#if teamwinners} @@ -180,7 +180,7 @@
-
+

Podiums:

{#if podiums} @@ -199,7 +199,7 @@
-
+

Picked ({picked.length}/{currentpicked.length}):

@@ -218,7 +218,7 @@
-
+

Missing ({outstanding.length}/{currentpicked.length}):

@@ -242,256 +242,285 @@ {/await} {/if} - -
-
+ +
+
-
+
- -
- - Hottake -
- - {#await data.seasonpicks then seasonpicks} - {#if seasonpicks.length > 0} - -
- - WDC -
- - -
- - WCC -
- - -
- - Overtakes -
- - -
- - DNFs -
- - -
- - Doohan -
- - -
- +
+ {#await data.seasonpickedusers then seasonpicked} + {#each seasonpicked as user} +
- Teamwinners -
- - -
- - Podiums -
- {/if} - {/await} + +
+ +
+ {user.firstname} +
+
+
+ {/each} + {/await} +
-
- {#await Promise.all( [data.seasonpickedusers, data.seasonpicks, data.hottakes, data.drivers, data.teams], ) then [seasonpicked, seasonpicks, hottakes, drivers, teams]} - {#each seasonpicked as user} - {@const hottake = hottakes.filter((take: Hottake) => take.user === user.id)[0] ?? undefined} - {@const pick = - seasonpicks.filter((pick: SeasonPick) => pick.user === user.id)[0] ?? undefined} - {@const wdcwinner = pick ? get_by_value(drivers, "id", pick.wdcwinner) : undefined} - {@const wccwinner = pick ? get_by_value(teams, "id", pick.wccwinner) : undefined} - {@const mostovertakes = pick ? get_by_value(drivers, "id", pick.mostovertakes) : undefined} - {@const mostdnfs = pick ? get_by_value(drivers, "id", pick.mostdnfs) : undefined} - {@const drivers_sorted = drivers - .filter((driver: Driver) => driver.active) - .sort((a: Driver, b: Driver) => a.code.localeCompare(b.code)) - .sort((a: Driver, b: Driver) => a.team.localeCompare(b.team))} +
+ +
+ +
+ + Hottake +
-
- -
- -
- {user.firstname} -
+ {#await data.seasonpicks then seasonpicks} + {#if seasonpicks.length > 0} + +
+ + WDC
- + +
+ + WCC +
+ + +
+ + Overtakes +
+ + +
+ + DNFs +
+ + +
+ + Doohan +
+ + +
+ + Teamwinners +
+ + +
+ + Podiums +
+ {/if} + {/await} +
+ + +
+ {#await Promise.all( [data.seasonpickedusers, data.seasonpicks, data.hottakes, data.drivers, data.teams], ) then [seasonpicked, seasonpicks, hottakes, drivers, teams]} + {#each seasonpicked as user} + {@const hottake = + hottakes.filter((take: Hottake) => take.user === user.id)[0] ?? undefined} + {@const pick = + seasonpicks.filter((pick: SeasonPick) => pick.user === user.id)[0] ?? undefined} + {@const wdcwinner = pick ? get_by_value(drivers, "id", pick.wdcwinner) : undefined} + {@const wccwinner = pick ? get_by_value(teams, "id", pick.wccwinner) : undefined} + {@const mostovertakes = pick + ? get_by_value(drivers, "id", pick.mostovertakes) + : undefined} + {@const mostdnfs = pick ? get_by_value(drivers, "id", pick.mostdnfs) : undefined} + {@const drivers_sorted = drivers + .filter((driver: Driver) => driver.active) + .sort((a: Driver, b: Driver) => a.code.localeCompare(b.code)) + .sort((a: Driver, b: Driver) => a.team.localeCompare(b.team))} +
-
{hottake?.hottake ?? "?"}
+ +
+
+ {hottake?.hottake ?? "?"} +
+
+ + {#if seasonpicks.length > 0} + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ Jack Doohan startet {pick?.doohanstarts ?? "?"} mal. +
+
+ + +
+ {#if pick && pick.teamwinners} +
+ {#each drivers_sorted as driver} + {@const color: string = get_by_value(teams, "id", driver?.team ?? "")?.color ?? ""} +
+
+ + + + {driver?.code} + +
+
+ {/each} +
+ {/if} +
+ + + +
+ {#if pick && pick.podiums} +
+ {#each drivers_sorted as driver} + {@const color: string = get_by_value(teams, "id", driver?.team ?? "")?.color ?? ""} +
+
+ + + + {driver?.code} + +
+
+ {/each} +
+ {/if} +
+ {/if}
- - {#if seasonpicks.length > 0} - -
-
- - -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- Jack Doohan startet {pick?.doohanstarts ?? "?"} mal. -
-
- - -
- {#if pick && pick.teamwinners} -
- {#each drivers_sorted as driver} - {@const color: string = get_by_value(teams, "id", driver?.team ?? "")?.color ?? ""} -
-
- - - - {driver?.code} - -
-
- {/each} -
- {/if} -
- - - -
- {#if pick && pick.podiums} -
- {#each drivers_sorted as driver} - {@const color: string = get_by_value(teams, "id", driver?.team ?? "")?.color ?? ""} -
-
- - - - {driver?.code} - -
-
- {/each} -
- {/if} -
- {/if} -
- {/each} - {/await} + {/each} + {/await} +
+ {#await Promise.all([data.seasonpicks, data.currentrace]) then [seasonpicks, currentrace]} {#if seasonpicks.length <= 0 && currentrace}