Add standing diff to stats page
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 14s
All checks were successful
Build Formula10 Docker Image / build-docker (push) Successful in 14s
This commit is contained in:
@ -43,7 +43,7 @@ DRIVER_RACE_POINTS: Dict[int, int] = {
|
|||||||
10: 1
|
10: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
STANDING_2023: Dict[str, int] = {
|
WDC_STANDING_2023: Dict[str, int] = {
|
||||||
"Max Verstappen": 1,
|
"Max Verstappen": 1,
|
||||||
"Sergio Perez": 2,
|
"Sergio Perez": 2,
|
||||||
"Lewis Hamilton": 3,
|
"Lewis Hamilton": 3,
|
||||||
@ -66,6 +66,19 @@ STANDING_2023: Dict[str, int] = {
|
|||||||
"Logan Sargeant": 21
|
"Logan Sargeant": 21
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WCC_STANDING_2023: Dict[str, int] = {
|
||||||
|
"Red Bull": 1,
|
||||||
|
"Mercedes": 2,
|
||||||
|
"Ferrari": 3,
|
||||||
|
"McLaren": 4,
|
||||||
|
"Aston Martin": 5,
|
||||||
|
"Alpine": 6,
|
||||||
|
"Williams": 7,
|
||||||
|
"VCARB": 8,
|
||||||
|
"Sauber": 9,
|
||||||
|
"Haas": 10
|
||||||
|
}
|
||||||
|
|
||||||
def standing_points(race_guess: RaceGuess, race_result: RaceResult) -> int:
|
def standing_points(race_guess: RaceGuess, race_result: RaceResult) -> int:
|
||||||
guessed_driver_position: int | None = race_result.driver_standing_position(driver=race_guess.pxx_guess)
|
guessed_driver_position: int | None = race_result.driver_standing_position(driver=race_guess.pxx_guess)
|
||||||
if guessed_driver_position is None:
|
if guessed_driver_position is None:
|
||||||
@ -166,7 +179,15 @@ class PointsModel(Model):
|
|||||||
diff: Dict[str, int] = dict()
|
diff: Dict[str, int] = dict()
|
||||||
|
|
||||||
for driver in self.all_drivers(include_none=False):
|
for driver in self.all_drivers(include_none=False):
|
||||||
diff[driver.name] = STANDING_2023[driver.name] - self.wdc_standing_by_driver()[driver.name]
|
diff[driver.name] = WDC_STANDING_2023[driver.name] - self.wdc_standing_by_driver()[driver.name]
|
||||||
|
|
||||||
|
return diff
|
||||||
|
|
||||||
|
def wcc_diff_2023(self) -> Dict[str, int]:
|
||||||
|
diff: Dict[str, int] = dict()
|
||||||
|
|
||||||
|
for team in self.all_teams(include_none=False):
|
||||||
|
diff[team.name] = WCC_STANDING_2023[team.name] - self.wcc_standing_by_team()[team.name]
|
||||||
|
|
||||||
return diff
|
return diff
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
<th scope="col" class="text-center" style="min-width: 50px;">Driver</th>
|
<th scope="col" class="text-center" style="min-width: 50px;">Driver</th>
|
||||||
<th scope="col" class="text-center" style="min-width: 100px;">Points</th>
|
<th scope="col" class="text-center" style="min-width: 100px;">Points</th>
|
||||||
<th scope="col" class="text-center" style="min-width: 100px;">DNFs</th>
|
<th scope="col" class="text-center" style="min-width: 100px;">DNFs</th>
|
||||||
|
<th scope="col" class="text-center" style="min-width: 100px;">Place Delta</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -43,6 +44,7 @@
|
|||||||
<td class="text-center text-nowrap">{{ driver.name }}</td>
|
<td class="text-center text-nowrap">{{ driver.name }}</td>
|
||||||
<td class="text-center text-nowrap">{{ points.wdc_points()[driver.name] }}</td>
|
<td class="text-center text-nowrap">{{ points.wdc_points()[driver.name] }}</td>
|
||||||
<td class="text-center text-nowrap">{{ points.dnfs()[driver.name] }}</td>
|
<td class="text-center text-nowrap">{{ points.dnfs()[driver.name] }}</td>
|
||||||
|
<td class="text-center text-nowrap">{{ "%+d" % points.wdc_diff_2023()[driver.name] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -64,6 +66,7 @@
|
|||||||
<th scope="col" class="text-center" style="min-width: 50px;">Place</th>
|
<th scope="col" class="text-center" style="min-width: 50px;">Place</th>
|
||||||
<th scope="col" class="text-center" style="min-width: 50px;">Team</th>
|
<th scope="col" class="text-center" style="min-width: 50px;">Team</th>
|
||||||
<th scope="col" class="text-center" style="min-width: 100px;">Points</th>
|
<th scope="col" class="text-center" style="min-width: 100px;">Points</th>
|
||||||
|
<th scope="col" class="text-center" style="min-width: 100px;">Place Delta</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -74,6 +77,7 @@
|
|||||||
<td class="text-center text-nowrap">{{ team_standing }}</td>
|
<td class="text-center text-nowrap">{{ team_standing }}</td>
|
||||||
<td class="text-center text-nowrap">{{ team.name }}</td>
|
<td class="text-center text-nowrap">{{ team.name }}</td>
|
||||||
<td class="text-center text-nowrap">{{ points.wcc_points()[team.name] }}</td>
|
<td class="text-center text-nowrap">{{ points.wcc_points()[team.name] }}</td>
|
||||||
|
<td class="text-center text-nowrap">{{ points.wcc_diff_2023()[team.name] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Reference in New Issue
Block a user