mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-15 08:59:55 +00:00
API Fetch Activity format=...
.. when retreiving an activity using the API you can now specify the format you want the data to be returned in. it can be one of; tcx - garmin training centre xml pwx - training peaks xml json - goldencheetah json csv - all available data (not powertap csv) .. along the way the file writers for the respective formats now accept a NULL context to work standalone. this may be useful as a file conversion tool.
This commit is contained in:
@@ -616,9 +616,11 @@ RideFile *RideFileFactory::openRideFile(Context *context, QFile &file,
|
||||
|
||||
// Construct the summary text used on the calendar
|
||||
QString calendarText;
|
||||
foreach (FieldDefinition field, context->athlete->rideMetadata()->getFields()) {
|
||||
if (field.diary == true && result->getTag(field.name, "") != "") {
|
||||
calendarText += field.calendarText(result->getTag(field.name, ""));
|
||||
if (context) { // will be null in standalone open
|
||||
foreach (FieldDefinition field, context->athlete->rideMetadata()->getFields()) {
|
||||
if (field.diary == true && result->getTag(field.name, "") != "") {
|
||||
calendarText += field.calendarText(result->getTag(field.name, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
result->setTag("Calendar Text", calendarText);
|
||||
@@ -627,7 +629,7 @@ RideFile *RideFileFactory::openRideFile(Context *context, QFile &file,
|
||||
result->setTag("Filename", QFileInfo(file.fileName()).fileName());
|
||||
result->setTag("Device", result->deviceType());
|
||||
result->setTag("File Format", result->fileFormat());
|
||||
result->setTag("Athlete", context->athlete->cyclist);
|
||||
if (context) result->setTag("Athlete", context->athlete->cyclist);
|
||||
result->setTag("Year", result->startTime().toString("yyyy"));
|
||||
result->setTag("Month", result->startTime().toString("MMMM"));
|
||||
result->setTag("Weekday", result->startTime().toString("ddd"));
|
||||
@@ -656,7 +658,7 @@ RideFile *RideFileFactory::openRideFile(Context *context, QFile &file,
|
||||
DataProcessorFactory::instance().autoProcess(result);
|
||||
|
||||
// calculate derived data series -- after data fixers applied above
|
||||
result->recalculateDerivedSeries();
|
||||
if (context) result->recalculateDerivedSeries();
|
||||
|
||||
// what data is present - after processor in case 'derived' or adjusted
|
||||
QString flags;
|
||||
|
||||
Reference in New Issue
Block a user