From 50024da7b5217d305a4cdb1f44fc0c14f426340c Mon Sep 17 00:00:00 2001 From: Fabian Keunecke Date: Tue, 13 Dec 2022 11:23:33 +0100 Subject: [PATCH] Fix parsing round integer coordinates --- CHANGELOG.md | 5 +++++ station/lib/station_model.dart | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f31f4..7782eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ CHANGELOG ## Upcoming version ## +## 1.2.2 (2022-12-13) ## + +* 🐞 Integer coordinates were not parsed correctly ([#47](https://github.com/tankste/app/issues/44)) + + ## 1.2.1 (2022-11-21) ## * 🐞 Integer prices were not parsed correctly ([#44](https://github.com/tankste/app/issues/44)) diff --git a/station/lib/station_model.dart b/station/lib/station_model.dart index 2b9d87f..385fc44 100644 --- a/station/lib/station_model.dart +++ b/station/lib/station_model.dart @@ -26,16 +26,25 @@ class StationModel { parsedJson['place']?.trim() ?? "", ), StationPricesModel( - (priceType == "e5" ? _parseDouble(parsedJson['price']) : _parseDouble(parsedJson['e5'])) ?? 0.0, + (priceType == "e5" + ? _parseDouble(parsedJson['price']) + : _parseDouble(parsedJson['e5'])) ?? + 0.0, StationPriceRange.unknown, - (priceType == "e10" ? _parseDouble(parsedJson['price']) : _parseDouble(parsedJson['e10'])) ?? 0.0, + (priceType == "e10" + ? _parseDouble(parsedJson['price']) + : _parseDouble(parsedJson['e10'])) ?? + 0.0, StationPriceRange.unknown, - (priceType == "diesel" ? _parseDouble(parsedJson['price']) : _parseDouble(parsedJson['diesel'])) ?? 0.0, + (priceType == "diesel" + ? _parseDouble(parsedJson['price']) + : _parseDouble(parsedJson['diesel'])) ?? + 0.0, StationPriceRange.unknown, ), CoordinateModel( - parsedJson['lat'] ?? "", - parsedJson['lng'] ?? "", + _parseDouble(parsedJson['lat']) ?? 0.0, + _parseDouble(parsedJson['lng']) ?? 0.0, ), _parseOpenTimes(parsedJson), parsedJson['isOpen'] ?? false,