mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 16:39:57 +00:00
Enable Python DPs use Metadata in automatic mode (#4336)
Data Processors running on import are applied before the activity is added to RideCache and metrics are computed, this behavior is by design, likely to optimize resource usage on bulk import. So activityMetrics API is not available; a new getTag API was added for this case and setTag/delTag/hasTag changed to work in this context too. When the Python fix is executed on activities already in the cache either via Edit menu, Filters or other Python Fix changes are notified via the corresponding RideItem. Fixes #4095 [publish binaries]
This commit is contained in:
committed by
GitHub
parent
42c43c7689
commit
67136b3cdf
@@ -1,5 +1,6 @@
|
||||
#include "FixPyDataProcessor.h"
|
||||
#include "FixPyRunner.h"
|
||||
#include "Athlete.h"
|
||||
|
||||
// Config widget used by the Preferences/Options config panes
|
||||
class FixPyDataProcessorConfig : public DataProcessorConfig
|
||||
@@ -24,7 +25,17 @@ bool FixPyDataProcessor::postProcess(RideFile *rideFile, DataProcessorConfig *se
|
||||
QString errText;
|
||||
bool useNewThread = op != "PYTHON";
|
||||
Context* context = (rideFile) ? rideFile->context : nullptr;
|
||||
FixPyRunner pyRunner(context, rideFile, useNewThread);
|
||||
RideItem* rideItem = nullptr;
|
||||
if (context && rideFile) {
|
||||
// get RideItem from RideFile for Python functions using it
|
||||
foreach(RideItem *item, context->athlete->rideCache->rides()) {
|
||||
if (item->dateTime == rideFile->startTime()) {
|
||||
rideItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
FixPyRunner pyRunner(context, rideFile, rideItem, useNewThread);
|
||||
return pyRunner.run(pyScript->source, pyScript->iniKey, errText) == 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user