diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 809cec9..8f32779 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -9,6 +9,7 @@ import type { RacePick, RacePickPoints, RacePickPointsAcc, + RacePickPointsTotal, RaceResult, ScrapedDriverStanding, ScrapedRaceResult, @@ -281,7 +282,7 @@ export const fetch_racepickpoints = async ( }; /** - * Fetch all [RacePickPointsAcc] from the database, ordered descendingly by total points. + * Fetch all [RacePickPointsAcc] from the database, ordered ascendingly by step. */ export const fetch_racepickpointsacc = async ( fetch: (_: any) => Promise, @@ -293,6 +294,19 @@ export const fetch_racepickpointsacc = async ( return racepickpointsacc; }; +/** + * Fetch all [RacePickPointsTotal] from the database, ordered descendingly by total points. + */ +export const fetch_racepickpointstotal = async ( + fetch: (_: any) => Promise, +): Promise => { + const racepickpointstotal: RacePickPointsTotal[] = await pb + .collection("racepickpointstotal") + .getFullList({ fetch: fetch }); + + return racepickpointstotal; +}; + /** * Fetch all [ScrapedDriverStandings] from the database, ordered ascendingly by position. */ diff --git a/src/lib/schema.ts b/src/lib/schema.ts index 025236c..e088425 100644 --- a/src/lib/schema.ts +++ b/src/lib/schema.ts @@ -140,11 +140,21 @@ export interface RacePickPoints { } export interface RacePickPointsAcc { + id: string; + user: string; + step: number; + acc_pxx_points: number; + acc_dnf_points: number; + acc_points: number; +} + +export interface RacePickPointsTotal { id: string; user: string; total_pxx_points: number; total_dnf_points: number; total_points: number; + total_points_per_pick: number; } // Scraped Data