mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-16 01:19:57 +00:00
API ride list add metadata
.. by default no metadata is provided when you get a ride list. So we now let you specify via a parameter what metadata fields you want. e.g. http://localhost:12021/athlete?metadata=all http://localhost:12021/athlete?metadata=Workout_Code,Recording_Interval Metric overrides are ignored and all data is fixed to never send a double quote ("), it is converted to a single quote (') to avoid tripping up CSV parsers. To show it is a string field both the heading and content are always surrounded by double quotes.
This commit is contained in:
@@ -227,6 +227,17 @@ APIWebService::writeRideLine(RideItem &item, HttpRequest *request, HttpResponse
|
||||
response->bwrite(QString("%1").arg(value, 'f').simplified().toLocal8Bit());
|
||||
}
|
||||
}
|
||||
|
||||
// all the metadata asked for
|
||||
foreach(QString name, settings->metawanted) {
|
||||
QString text = item.getText(name,"");
|
||||
text.replace("\"","'"); // don't use double quotes!
|
||||
|
||||
response->bwrite(",\"");
|
||||
response->bwrite(text.toLocal8Bit());
|
||||
response->bwrite("\"");
|
||||
}
|
||||
|
||||
response->bwrite("\n");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user