Skip to content

Commit

Permalink
[team details] fix #153
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightDV committed May 2, 2024
1 parent 2f2d682 commit 49f8a27
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions lib/Screens/team_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ class TeamResults extends StatelessWidget {
snapshot.data![index - 1][0],
5,
),
if (snapshot.data![index - 1].length > 1)
DriverResultItem(
snapshot.data![index - 1][1],
5,
Expand Down
39 changes: 20 additions & 19 deletions lib/api/ergast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -428,25 +428,26 @@ class _ErgastApiCalls {
raceId: race['Circuit']['circuitId'],
raceName: race['raceName'],
),
DriverResult(
race['Results'][1]['Driver']['driverId'],
race['Results'][1]['position'],
race['Results'][1]['number'],
race['Results'][1]['Driver']['givenName'],
race['Results'][1]['Driver']['familyName'],
race['Results'][1]['Driver']['code'],
race['Results'][1]['Constructor']['constructorId'],
race['Results'][1]['Time']?['time'] ?? 'DNF',
int.parse(race['Results'][1]['FastestLap']?['rank'] ?? '20') == 1
? true
: false,
race['Results'][1]['FastestLap']?['Time']['time'] ?? '00:00:00',
race['Results'][1]['FastestLap']?['rank'] ?? '20',
lapsDone: race['Results'][1]['laps'],
points: race['Results'][1]['points'],
raceId: race['Circuit']['circuitId'],
raceName: race['raceName'],
),
if (race['Results'].length > 1)
DriverResult(
race['Results'][1]['Driver']['driverId'],
race['Results'][1]['position'],
race['Results'][1]['number'],
race['Results'][1]['Driver']['givenName'],
race['Results'][1]['Driver']['familyName'],
race['Results'][1]['Driver']['code'],
race['Results'][1]['Constructor']['constructorId'],
race['Results'][1]['Time']?['time'] ?? 'DNF',
int.parse(race['Results'][1]['FastestLap']?['rank'] ?? '20') == 1
? true
: false,
race['Results'][1]['FastestLap']?['Time']['time'] ?? '00:00:00',
race['Results'][1]['FastestLap']?['rank'] ?? '20',
lapsDone: race['Results'][1]['laps'],
points: race['Results'][1]['points'],
raceId: race['Circuit']['circuitId'],
raceName: race['raceName'],
),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/helpers/convert_ergast_and_formula_one.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Convert {
'mercedes': 'Mercedes',
'alpine': 'Alpine',
'mclaren': 'McLaren',
'alphatauri': 'AlphaTauri',
'rb': 'RB',
'aston_martin': 'Aston-Martin',
'williams': 'Williams',
'sauber': 'Kick-Sauber',
Expand Down

0 comments on commit 49f8a27

Please sign in to comment.