Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
When F1 Champion
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zandor Smith
When F1 Champion
Commits
6ea0b32e
Commit
6ea0b32e
authored
2 weeks ago
by
Zandor Smith
Browse files
Options
Downloads
Patches
Plain Diff
More fixes after team swap.
parent
6929223c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#449998
passed
2 weeks ago
Stage: build
Stage: deploy
Stage: code-intelligence
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pages/YearRoute.jsx
+9
-2
9 additions, 2 deletions
src/pages/YearRoute.jsx
src/utility/champCalculator.js
+7
-3
7 additions, 3 deletions
src/utility/champCalculator.js
with
16 additions
and
5 deletions
src/pages/YearRoute.jsx
+
9
−
2
View file @
6ea0b32e
...
...
@@ -70,10 +70,17 @@ function combineDriverPoints2024(points) {
}
function
calculateDriverPoints2025
(
points
,
races
,
teams
,
results
)
{
const
drivers
=
Object
.
values
(
teams
).
map
((
team
)
=>
team
.
drivers
).
reduce
((
acc
,
val
)
=>
acc
.
concat
(
val
),
[]);
const
drivers
=
Object
.
values
(
teams
).
map
((
team
)
=>
{
return
team
.
drivers
.
map
((
driver
)
=>
{
return
driver
.
split
(
"
-
"
)[
0
];
});
}).
reduce
((
acc
,
val
)
=>
acc
.
concat
(
val
),
[]);
let
driverPoints
=
{};
drivers
.
forEach
((
driver
)
=>
{
driverPoints
[
driver
]
=
getCurrentPointsOfDriver
(
driver
,
points
,
races
,
results
);
if
(
!
driverPoints
[
driver
])
{
driverPoints
[
driver
]
=
0
;
}
driverPoints
[
driver
]
+=
getCurrentPointsOfDriver
(
driver
,
points
,
races
,
results
);
});
let
driverPointsSorted
=
{};
Object
.
entries
(
driverPoints
).
sort
((
a
,
b
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/utility/champCalculator.js
+
7
−
3
View file @
6ea0b32e
...
...
@@ -35,14 +35,18 @@ function getPointsOfDriverForRace(driver, points, race, results) {
if
(
!
result
)
{
return
null
;
}
const
position
=
result
.
positions
.
indexOf
(
driver
);
const
driverShort
=
driver
.
split
(
"
-
"
)[
0
];
const
positionsNoTeam
=
result
.
positions
.
map
((
position
)
=>
{
return
position
.
split
(
"
-
"
)[
0
];
});
const
position
=
positionsNoTeam
.
indexOf
(
driverShort
)
+
1
;
if
(
position
===
-
1
)
{
return
0
;
}
const
positionPoints
=
pointsSystem
.
points
.
find
((
points
,
index
)
=>
{
return
index
===
position
;
return
index
+
1
===
position
;
});
if
(
result
.
fastestLap
===
driver
)
{
if
(
result
.
fastestLap
===
driver
Short
)
{
return
positionPoints
+
pointsSystem
.
fastestLap
;
}
return
positionPoints
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment