Skip to content

Commit

Permalink
Merge pull request #48 from tankste/feature/47-force-parsing-coordina…
Browse files Browse the repository at this point in the history
…tes-as-double

Fix parsing round integer coordinates
  • Loading branch information
Fabi755 authored Dec 13, 2022
2 parents 4030dd4 + 50024da commit 5ea69c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
19 changes: 14 additions & 5 deletions station/lib/station_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5ea69c9

Please sign in to comment.