Commit d174917a authored by Volker Krause's avatar Volker Krause
Browse files

Fix parsing of numeric GBFS station ids

This fixes availability information for rental bikes in e.g. Paris.
parent 16ebb6c8
Pipeline #62797 passed with stage
in 23 seconds
......@@ -49,6 +49,14 @@ struct QueryContext {
QString errorMessage;
static QString stationIdToString(const QJsonValue &id)
if (id.isDouble()) {
return QString::number(id.toInt());
return id.toString();
static void appendResults(const GBFSService &service, const LocationRequest &req, QueryContext *context)
GBFSStore store(service.systemId);
......@@ -73,7 +81,7 @@ static void appendResults(const GBFSService &service, const LocationRequest &req
loc.setCoordinate(lat, lon);
const auto stationId = station.value(QLatin1String("station_id")).toString();
const auto stationId = stationIdToString(station.value(QLatin1String("station_id")));
loc.setIdentifier(service.systemId, stationId);
// TODO cover more properties
......@@ -90,7 +98,7 @@ static void appendResults(const GBFSService &service, const LocationRequest &req
const auto status = statusDoc.object().value(QLatin1String("data")).toObject().value(QLatin1String("stations")).toArray();
for (const auto statV : status) {
const auto stat = statV.toObject();
const auto id = stat.value(QLatin1String("station_id")).toString();
const auto id = stationIdToString(stat.value(QLatin1String("station_id")));
const auto it = std::find(selectedStationIds.begin(), selectedStationIds.end(), id);
if (it == selectedStationIds.end()) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment