Commit d13be572 authored by Administrator's avatar Administrator

prevent nonParsable, excluded and manual activities to be parsed

parent 0df9c506
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-08-31 15:25:36.226293","version":"1.20.2"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_secure_storage-3.3.3/","dependencies":[]},{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.11/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"uni_links","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/uni_links-0.4.0/","dependencies":[]},{"name":"url_launcher","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-5.5.0/","dependencies":[]}],"macos":[{"name":"package_info","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/package_info-0.4.1/","dependencies":[]},{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+7/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+1/","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.0.1+1/","dependencies":[]}],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.2/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"uni_links","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-08-31 16:01:50.767940","version":"1.20.2"}
\ No newline at end of file
......@@ -42,7 +42,11 @@ Future<void> downloadDemoData({
activities = await athlete.activities;
final List<Activity> downloadedActivities = activities
.where((Activity activity) => activity.state == 'downloaded')
.where((Activity activity) =>
activity.state == 'downloaded' &&
activity.nonParsable != true &&
activity.manual != true &&
activity.excluded != true)
.toList();
for (final Activity activity in downloadedActivities) {
await parseActivity(
......
......@@ -26,7 +26,11 @@ Future<void> importActivitiesLocally({
activities = await athlete.activities;
final List<Activity> downloadedActivities = activities
.where((Activity activity) => activity.state == 'downloaded')
.where((Activity activity) =>
activity.state == 'downloaded' &&
activity.nonParsable != true &&
activity.manual != true &&
activity.excluded != true)
.toList();
for (final Activity activity in downloadedActivities) {
await parseActivity(
......
......@@ -40,7 +40,6 @@ Future<void> parseActivity({
}
}
} catch (exception) {
print(exception);
final Log log = Log(
message: exception.runtimeType.toString(),
method: 'parseActivity',
......@@ -48,6 +47,8 @@ Future<void> parseActivity({
comment: '/lib/actions/parse_activity.25',
);
await log.save();
activity.nonParsable = true;
await activity.save();
await flushbar?.dismiss();
flushbar = Flushbar<Object>(
message: 'Error, see log on home screen for details',
......
......@@ -33,8 +33,11 @@ Future<void> updateJob({
);
}
final Iterable<Activity> downloadedActivities =
activities.where((Activity activity) => activity.state == 'downloaded');
final Iterable<Activity> downloadedActivities = activities.where(
(Activity activity) =>
activity.state == 'downloaded' &&
activity.manual != true &&
activity.excluded != true);
for (final Activity activity in downloadedActivities) {
await parseActivity(
context: context,
......
......@@ -68,10 +68,13 @@ class Activity {
HeartRateZone _heartRateZone;
HeartRateZoneSchema _heartRateZoneSchema;
// Getter
int get id => _db?.id;
DateTime get startTime => _db.startTime;
DateTime get timeCreated => _db.timeCreated;
DateTime get timeStamp => _db.timeStamp;
String get event => _db.event;
String get eventType => _db.eventType;
String get name => _db.name;
......@@ -80,6 +83,11 @@ class Activity {
String get subSport => _db.subSport;
String get trigger => _db.trigger;
String get type => _db.type;
bool get excluded => _db.excluded;
bool get manual => _db.manual;
bool get nonParsable => _db.nonParsable;
double get avgFormPower => _db.avgFormPower;
double get avgFractionalCadence => _db.avgFractionalCadence;
double get avgGroundTime => _db.avgGroundTime;
......@@ -88,9 +96,9 @@ class Activity {
double get avgPowerRatio => _db.avgPowerRatio;
double get avgRunningCadence => _db.avgRunningCadence;
double get avgSpeed => _db.avgSpeed;
double get avgSpeedByDistance => _db.avgSpeedByDistance;
double get avgSpeedByMeasurements => _db.avgSpeedByMeasurements;
double get avgSpeedBySpeed => _db.avgSpeedBySpeed;
double get avgSpeedByDistance => _db.avgSpeedByDistance;
double get avgStanceTime => _db.avgStanceTime;
double get avgStanceTimePercent => _db.avgStanceTimePercent;
double get avgStrideRatio => _db.avgStrideRatio;
......@@ -119,9 +127,6 @@ class Activity {
double get swcLat => _db.swcLat;
double get swcLong => _db.swcLong;
double get totalFractionalCycles => _db.totalFractionalCycles;
bool get nonParsable => _db.nonParsable;
bool get manual => _db.manual;
bool get excluded => _db.excluded;
int get athletesId => _db.athletesId;
int get avgHeartRate => _db.avgHeartRate;
......@@ -194,10 +199,15 @@ class Activity {
bool get legSpringStiffnessAvailable =>
!<num>[null, -1].contains(avgLegSpringStiffness);
// Setter
set excluded(bool value) => _db.excluded = value;
set ftp(double value) => _db.ftp = value;
set manual(bool value) => _db.manual = value;
set maxHeartRate(int value) => _db.maxHeartRate = value;
set name(String value) => _db.name = value;
set nonParsable(bool value) => _db.nonParsable = value;
set state(String value) => _db.state = value;
set ftp(double value) => _db.ftp = value;
Future<BoolResult> delete() async => await _db.delete();
Future<int> save() async => await _db.save();
......@@ -208,7 +218,6 @@ class Activity {
@override
String toString() => '< Activity | $name | $startTime >';
Duration movingDuration() => Duration(seconds: movingTime ?? 0);
dynamic getAttribute(ActivityAttr activityAttr) {
switch (activityAttr) {
......
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