Skip to content

Commit

Permalink
[team details] fix wrong DNFs
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed May 2, 2024
1 parent 49f8a27 commit eebe6c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/Screens/team_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ class TeamResults extends StatelessWidget {
5,
),
if (snapshot.data![index - 1].length > 1)
DriverResultItem(
snapshot.data![index - 1][1],
5,
),
DriverResultItem(
snapshot.data![index - 1][1],
5,
),
],
),
)
Expand Down
12 changes: 10 additions & 2 deletions lib/api/ergast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,10 @@ class _ErgastApiCalls {
race['Results'][0]['Driver']['familyName'],
race['Results'][0]['Driver']['code'],
race['Results'][0]['Constructor']['constructorId'],
race['Results'][0]['Time']?['time'] ?? 'DNF',
race['Results'][0]['positionText'] == 'R'
? 'DNF'
: race['Results'][0]['Time']?['time'] ??
race['Results'][0]['status'],
int.parse(race['Results'][0]['FastestLap']?['rank'] ?? '20') == 1
? true
: false,
Expand All @@ -427,6 +430,7 @@ class _ErgastApiCalls {
points: race['Results'][0]['points'],
raceId: race['Circuit']['circuitId'],
raceName: race['raceName'],
status: race['Results'][0]['status'],
),
if (race['Results'].length > 1)
DriverResult(
Expand All @@ -437,7 +441,10 @@ class _ErgastApiCalls {
race['Results'][1]['Driver']['familyName'],
race['Results'][1]['Driver']['code'],
race['Results'][1]['Constructor']['constructorId'],
race['Results'][1]['Time']?['time'] ?? 'DNF',
race['Results'][1]['positionText'] == 'R'
? 'DNF'
: race['Results'][1]['Time']?['time'] ??
race['Results'][1]['status'],
int.parse(race['Results'][1]['FastestLap']?['rank'] ?? '20') == 1
? true
: false,
Expand All @@ -447,6 +454,7 @@ class _ErgastApiCalls {
points: race['Results'][1]['points'],
raceId: race['Circuit']['circuitId'],
raceName: race['raceName'],
status: race['Results'][1]['status'],
),
],
);
Expand Down

0 comments on commit eebe6c0

Please sign in to comment.