Skip to content

Commit

Permalink
fix(api): rename 'bateau' to 'bateaux'
Browse files Browse the repository at this point in the history
Following a change into the Bordeaux Metropole API, change the field name to get the boat name from 'bateau' to 'bateaux'
  • Loading branch information
vareversat committed May 13, 2024
1 parent 2c76816 commit b91c67c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/bloc/forecast/forecast_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ForecastBloc extends Bloc<ForecastEvent, ForecastState> {
final body = json.decode(response.body);

return (body['records'] as List).map((json) {
if (json['fields']['bateau'].toString().toLowerCase() ==
if (json['fields']['bateaux'].toString().toLowerCase() ==
'maintenance') {
final maintenanceForecast = MaintenanceForecast.fromJSON(json);

Expand Down
2 changes: 1 addition & 1 deletion lib/models/boat_forecast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BoatForecast extends AbstractForecast {

List<Boat> boats = [];
bool isLeaving = false;
final rawBoatName = json['fields']['bateau'] as String;
final rawBoatName = json['fields']['bateaux'] as String;
final boatNames = rawBoatName.split(RegExp(r'/'));
for (final boatName in boatNames) {
final trimmedBoatName = boatName.trim();
Expand Down
4 changes: 2 additions & 2 deletions test/units/boat_forecast_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void main() {
'recordid': '82c316d304b1adef7eeef9edc9ab7b257f766086',
'fields': {
'fermeture_totale': 'oui',
'bateau': 'MARITE',
'bateaux': 'MARITE',
'date_passage': '2023-03-02',
're_ouverture_a_la_circulation': '16:49',
'fermeture_a_la_circulation': '15:49',
Expand All @@ -62,7 +62,7 @@ void main() {
'recordid': '82c316d304b1adef7eeef9edc9ab7b257f766086',
'fields': {
'fermeture_totale': 'oui',
'bateau': 'MARITE',
'bateaux': 'MARITE',
'date_passage': '2023-03-15',
're_ouverture_a_la_circulation': '16:49',
'fermeture_a_la_circulation': '15:49',
Expand Down

0 comments on commit b91c67c

Please sign in to comment.