Skip to content

Commit

Permalink
Update to next season
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Moitié committed Dec 12, 2023
1 parent cca68a9 commit 1423832
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"ImportDeclaration": { "minProperties": 12, "multiline": true, "consistent": true },
"ExportDeclaration": { "minProperties": 12, "multiline": true, "consistent": true }
}],
"react/jsx-props-no-spreading": [0]
"react/jsx-props-no-spreading": [0],
"quote-props": [0]
},
"plugins": [
"react",
Expand Down
47 changes: 39 additions & 8 deletions build/api/getSeason.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,48 @@ const trackTypeToCatId = {
dirt_road: 4,
};

const licenceGroupToMinlicenselevel = {
5: 18,
4: 12,
3: 8,
2: 4,
1: 1,
const licenceGroupToMinlicenselevel: {[key: string]: number} = {
'5': 18,
'4': 12,
'3': 8,
'2': 4,
'1': 1,
};

type carType = { id: number, sku: number };
type trackType = { ids: number, pkgid: number };
type trackType = { ids: Array<number>, pkgid: number };

export default async function getSeason(cars: Array<carType>, tracks: Array<trackType>) {
type TrackInfo = {
raceweek: number,
config: string,
name: string,
pkgid: number,
start: string,
weekLength: number,
race_time_descriptors: string,
race_lap_limit: number | null,
race_time_limit: number | null,
};

type SeasonInfo = {
seriesid: number,
seriesname: string,
start: string,
end: string,
tracks: Array<TrackInfo>,
catid: number,
isOfficial: boolean,
licenceGroup: 1 | 2 | 3 | 4 | 5,
licenceGroupName: string,
minlicenselevel: number,
isFixedSetup: boolean,
carclasses: Array<{shortname: string}>,
cars: Array<{sku: number}>,
carByWeek: boolean,
seasonid: number,
};

export default async function getSeason(cars: Array<carType>, tracks: Array<trackType>): Promise<Array<SeasonInfo>> {
const carMap = cars.reduce((carry, car) => ({
...carry,
[car.id]: car,
Expand Down Expand Up @@ -83,6 +113,7 @@ export default async function getSeason(cars: Array<carType>, tracks: Array<trac
isFixedSetup: series.fixed_setup,
carclasses: carClasses.map((carClass) => ({ shortname: carClass.short_name })),
cars: seriesCars.map(({ sku }) => ({ sku })),
carByWeek: false,
seasonid: series.season_id,
};
});
Expand Down
6 changes: 3 additions & 3 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import moment from 'moment';

export const seasonStart = moment('2023-09-12T00:00:00+00:00').utc();
export const seasonEnd = moment('2023-12-12T00:00:00+00:00').utc();
export const weekSeasonStart = moment('2023-09-12T00:00:00+00:00').utc();
export const seasonStart = moment('2023-12-12T00:00:00+00:00').utc();
export const seasonEnd = moment('2024-03-13T00:00:00+00:00').utc();
export const weekSeasonStart = moment('2024-03-12T00:00:00+00:00').utc();

export const firebaseConfig = {
apiKey: 'AIzaSyAWNRqHLhhvhzKl0gkKybocd0nAk2eTlVg',
Expand Down
5 changes: 5 additions & 0 deletions src/data/changelog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import moment from 'moment';

export default [{
date: moment('2023-12-12 00:00:00').utc(),
items: [
'Update to 2024S1',
],
}, {
date: moment('2023-12-05 00:00:00').utc(),
items: [
'Update to 2023S4W13',
Expand Down
120 changes: 70 additions & 50 deletions src/data/offWeeks.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ export default {
// ],
// },
// 207 │ 4114 │ NASCAR iRacing Series - Fixed | 2023-11-07
4114: {
offWeeks: [
13.1, 16.1,
],
},
// 4114: {
// offWeeks: [
// 13.1, 16.1,
// ],
// },
// 229 │ 4113 │ NASCAR iRacing Series - Open | 2023-11-07
4113: {
offWeeks: [
13.1, 16.1,
],
},
// 4113: {
// offWeeks: [
// 13.1, 16.1,
// ],
// },
// 438 │ 4118 │ eNASCAR Road to Pro Qual Series - Round 1
// 4118: {
// offWeeks: [
Expand All @@ -71,30 +71,30 @@ export default {
],
},
// 451 │ 4227 │ Creventic Endurance Series | 2023-12-05
4227: {
offWeeks: [
1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 3.1,
3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1,
],
},
// 4227: {
// offWeeks: [
// 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 3.1,
// 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1, 3.1,
// ],
// },
// 495 │ 4222 │ Formula A - Grand Prix Tour | 2023-11-28
4222: {
offWeeks: [
1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1,
],
},
// 4222: {
// offWeeks: [
// 1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1,
// ],
// },
// 496 │ 4223 │ Formula A - Grand Prix Tour - Fixed | 2023-11-28
4223: {
offWeeks: [
1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1,
],
},
// 4223: {
// offWeeks: [
// 1.1, 2.1, 3.1, 3.1, 3.1, 5.1, 8.1, 9.1, 11.1, 13.1, 13.1, 13.1, 15.1, 17.1, 18.1, 21.1,
// ],
// },
// 275 │ 4251 │ Nurburgring Endurance Championship | 2023-10-31
4251: {
offWeeks: [
1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 4.1, 4.1, 5.1, 5.1, 6.1, 6.1, 7.1, 7.1, 7.1, 7.1, 8.1, 8.1, 8.1,
],
},
// 4251: {
// offWeeks: [
// 1.1, 2.1, 2.1, 2.1, 2.1, 2.1, 3.1, 3.1, 4.1, 4.1, 5.1, 5.1, 6.1, 6.1, 7.1, 7.1, 7.1, 7.1, 8.1, 8.1, 8.1,
// ],
// },

// 469 │ 4315 | Global Endurance Pure Driving School Series | 2023-09-05
// 4315: {
Expand All @@ -104,41 +104,61 @@ export default {
// ],
// },
// 439 │ 4384 │ eNASCAR Road to Pro Qual Series - Round 2 | 2023-10-03
4384: {
offWeeks: [
1.1, 2.1, 3.1, 4.1, 5.1, 6.1,
],
},
// 4384: {
// offWeeks: [
// 1.1, 2.1, 3.1, 4.1, 5.1, 6.1,
// ],
// },
// 307 │ 4485 │ Dirt │ World of Outlaws Sprint Car Series | 2023-12-05
4485: {
// 4485: {
// weekStartOffset: { days: -1 },
},
// },
// 492 │ 4427 │ Road │ IMSA Michelin Pilot Challenge Series | 2023-12-05
4427: {
weekStartOffset: { days: 7 },
// 4427: {
// weekStartOffset: { days: 7 },
// offWeeks: [
// 1.1, 2.1, 3.1, 4.1, 5.1,
// ],
// },
// 331 │ 4458 │ Road │ European Endurance Pure Driving School Series | 2023-12-05
// 4458: {
// weekStartOffset: { days: 7 },
// offWeeks: [
// 1.1, 2.1, 3.1, 4.1, 5.1,
// ],
// },

// 419 │ 4459 │ Road │ IMSA Endurance Series | 2023-11-28
// 4459: {
// offWeeks: [
// 1.1, 2.1, 3.1, 4.1, 5.1,
// ],
// },
// 478 │ 4538 │ Oval │ eNASCAR RTP Contender Series
4538: {
weekStartOffset: { days: 6 },
offWeeks: [
1.1, 2.1, 3.1, 4.1, 5.1,
6.1,
],
},
// 3314458 │ Road │ European Endurance Pure Driving School Series | 2023-12-05
4458: {
// 4924589 │ Road │ C │ IMSA Michelin Pilot Challenge Series | 2024-03-05
4589: {
weekStartOffset: { days: 7 },
offWeeks: [
1.1, 2.1, 3.1, 4.1, 5.1,
],
},

// 419 │ 4459 │ Road │ IMSA Endurance Series | 2023-11-28
4459: {
// 331 │ 4622 │ Road │ B │ Global Endurance Pure Driving School Tour | 2024-03-05
4622: {
weekStartOffset: { days: 7 },
offWeeks: [
1.1, 2.1, 3.1, 4.1, 5.1,
],
},
// 478 │ 4538 │ Oval │ eNASCAR RTP Contender Series
4538: {
weekStartOffset: { days: 6 },
// 419 │ 4623 │ Road │ B │ IMSA Endurance Series | 2024-03-05
4623: {
offWeeks: [
6.1,
1.1, 2.1, 3.1, 4.1, 5.1,
],
},
};

0 comments on commit 1423832

Please sign in to comment.