Commit b2dacb04 authored by Administrator's avatar Administrator

git delete leftover events and laps from prior runs

parent b160e483
......@@ -46,22 +46,21 @@ class Activity extends ChangeNotifier {
}
setState(String state) {
db
..state = state
..save();
db.state = state;
db.save();
notifyListeners();
}
parse({@required Athlete athlete}) async {
var counter = 0;
var appDocDir = await getApplicationDocumentsDirectory();
print("Starting to parse activity ${db.stravaId}.");
var fitFile = FitFile(path: appDocDir.path + '/${db.stravaId}.fit').parse();
print("Parsing activity ${db.stravaId} done.");
print("Parsing .fit-File ${db.stravaId} done.");
// delete left overs from prior runs:
await db.getDbEvents().delete();
await db.getDbLaps().delete();
for (var dataMessage in fitFile.dataMessages) {
counter = counter + 1;
if (dataMessage.definitionMessage.globalMessageName == null) {
switch (dataMessage.definitionMessage.globalMessageNumber) {
case 13:
......@@ -187,7 +186,6 @@ class Activity extends ChangeNotifier {
"are not implemented yet.");
print(dataMessage.values.map((v) => v.fieldName).toList());
debugger();
print(counter);
}
}
}
......
......@@ -75,6 +75,7 @@ class Event {
..heartRate = dataMessage.get('avg_heart_rate').round()
..cadence = dataMessage.get('avg_running_cadence')
..timerTrigger = dataMessage.get('lap_trigger')
..distance = dataMessage.get('total_distance');
..distance = dataMessage.get('total_distance')
..save();
}
}
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