Commit 8adcaaad authored by Administrator's avatar Administrator

overview and metadata views on lap and activity level as grid, missing cached values on lap level

parent acb08131
{"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":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+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.4.7/","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":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+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.4.7/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+2/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+5/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1+5/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"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_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-05-14 14:40:28.724849","version":"1.17.1"}
\ 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":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+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.4.7/","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":"path_provider","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.8/","dependencies":[]},{"name":"shared_preferences","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.7+2/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+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.4.7/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+2/","dependencies":[]},{"name":"shared_preferences_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+8/","dependencies":[]},{"name":"sqflite","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/sqflite-1.3.0+1/","dependencies":[]},{"name":"url_launcher_macos","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.0.1+5/","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"shared_preferences_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+5/","dependencies":[]},{"name":"url_launcher_web","path":"/home/stefan/flutter/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_web-0.1.1+5/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"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_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2020-05-15 09:34:04.918390","version":"1.17.1"}
\ No newline at end of file
......@@ -206,6 +206,10 @@ const tableLap = SqfEntityTable(
SqfEntityField('avgStrydCadence', DbType.real),
SqfEntityField('sdevStrydCadence', DbType.real),
SqfEntityField('sdevVerticalOscillation', DbType.real),
SqfEntityField('avgPowerRatio', DbType.real),
SqfEntityField('sdevPowerRatio', DbType.real),
SqfEntityField('avgStrideRatio', DbType.real),
SqfEntityField('sdevStrideRatio', DbType.real),
SqfEntityFieldRelationship(
parentTable: tableActivity,
......
......@@ -245,6 +245,10 @@ class TableDbLap extends SqfEntityTableBase {
SqfEntityFieldBase('avgStrydCadence', DbType.real),
SqfEntityFieldBase('sdevStrydCadence', DbType.real),
SqfEntityFieldBase('sdevVerticalOscillation', DbType.real),
SqfEntityFieldBase('avgPowerRatio', DbType.real),
SqfEntityFieldBase('sdevPowerRatio', DbType.real),
SqfEntityFieldBase('avgStrideRatio', DbType.real),
SqfEntityFieldBase('sdevStrideRatio', DbType.real),
SqfEntityFieldRelationshipBase(
TableDbActivity.getInstance, DeleteRule.CASCADE,
defaultValue: 0, fieldName: 'activitiesId'),
......@@ -6466,6 +6470,10 @@ class DbLap {
this.avgStrydCadence,
this.sdevStrydCadence,
this.sdevVerticalOscillation,
this.avgPowerRatio,
this.sdevPowerRatio,
this.avgStrideRatio,
this.sdevStrideRatio,
this.activitiesId}) {
_setDefaultValues();
}
......@@ -6517,6 +6525,10 @@ class DbLap {
this.avgStrydCadence,
this.sdevStrydCadence,
this.sdevVerticalOscillation,
this.avgPowerRatio,
this.sdevPowerRatio,
this.avgStrideRatio,
this.sdevStrideRatio,
this.activitiesId) {
_setDefaultValues();
}
......@@ -6569,6 +6581,10 @@ class DbLap {
this.avgStrydCadence,
this.sdevStrydCadence,
this.sdevVerticalOscillation,
this.avgPowerRatio,
this.sdevPowerRatio,
this.avgStrideRatio,
this.sdevStrideRatio,
this.activitiesId) {
_setDefaultValues();
}
......@@ -6665,6 +6681,14 @@ class DbLap {
if (o['sdevVerticalOscillation'] != null)
sdevVerticalOscillation =
double.tryParse(o['sdevVerticalOscillation'].toString());
if (o['avgPowerRatio'] != null)
avgPowerRatio = double.tryParse(o['avgPowerRatio'].toString());
if (o['sdevPowerRatio'] != null)
sdevPowerRatio = double.tryParse(o['sdevPowerRatio'].toString());
if (o['avgStrideRatio'] != null)
avgStrideRatio = double.tryParse(o['avgStrideRatio'].toString());
if (o['sdevStrideRatio'] != null)
sdevStrideRatio = double.tryParse(o['sdevStrideRatio'].toString());
activitiesId = o['activitiesId'] as int;
// RELATIONSHIPS FromMAP
......@@ -6722,6 +6746,10 @@ class DbLap {
double avgStrydCadence;
double sdevStrydCadence;
double sdevVerticalOscillation;
double avgPowerRatio;
double sdevPowerRatio;
double avgStrideRatio;
double sdevStrideRatio;
int activitiesId;
BoolResult saveResult;
......@@ -6971,6 +6999,22 @@ class DbLap {
map['sdevVerticalOscillation'] = sdevVerticalOscillation;
}
if (avgPowerRatio != null) {
map['avgPowerRatio'] = avgPowerRatio;
}
if (sdevPowerRatio != null) {
map['sdevPowerRatio'] = sdevPowerRatio;
}
if (avgStrideRatio != null) {
map['avgStrideRatio'] = avgStrideRatio;
}
if (sdevStrideRatio != null) {
map['sdevStrideRatio'] = sdevStrideRatio;
}
if (activitiesId != null) {
map['activitiesId'] = activitiesId;
}
......@@ -7176,6 +7220,22 @@ class DbLap {
map['sdevVerticalOscillation'] = sdevVerticalOscillation;
}
if (avgPowerRatio != null) {
map['avgPowerRatio'] = avgPowerRatio;
}
if (sdevPowerRatio != null) {
map['sdevPowerRatio'] = sdevPowerRatio;
}
if (avgStrideRatio != null) {
map['avgStrideRatio'] = avgStrideRatio;
}
if (sdevStrideRatio != null) {
map['sdevStrideRatio'] = sdevStrideRatio;
}
if (activitiesId != null) {
map['activitiesId'] = activitiesId;
}
......@@ -7252,6 +7312,10 @@ class DbLap {
avgStrydCadence,
sdevStrydCadence,
sdevVerticalOscillation,
avgPowerRatio,
sdevPowerRatio,
avgStrideRatio,
sdevStrideRatio,
activitiesId
];
}
......@@ -7361,7 +7425,7 @@ class DbLap {
/// Returns a <List<BoolResult>>
Future<List<BoolResult>> saveAll(List<DbLap> dblaps) async {
final results = _mnDbLap.saveAll(
'INSERT OR REPLACE INTO laps (id, timeStamp, startTime, startPositionLat, startPositionLong, endPositionLat, endPositionLong, avgHeartRate, maxHeartRate, avgRunningCadence, event, eventType, eventGroup, sport, subSport, avgVerticalOscillation, totalElapsedTime, totalTimerTime, totalDistance, totalStrides, totalCalories, avgSpeed, maxSpeed, totalAscent, totalDescent, avgStanceTimePercent, avgStanceTime, maxRunningCadence, intensity, lapTrigger, avgTemperature, maxTemperature, avgFractionalCadence, maxFractionalCadence, totalFractionalCycles, avgPower, minPower, maxPower, sdevPower, avgGroundTime, sdevGroundTime, avgLegSpringStiffness, sdevLegSpringStiffness, avgFormPower, sdevFormPower, avgStrydCadence, sdevStrydCadence, sdevVerticalOscillation, activitiesId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
'INSERT OR REPLACE INTO laps (id, timeStamp, startTime, startPositionLat, startPositionLong, endPositionLat, endPositionLong, avgHeartRate, maxHeartRate, avgRunningCadence, event, eventType, eventGroup, sport, subSport, avgVerticalOscillation, totalElapsedTime, totalTimerTime, totalDistance, totalStrides, totalCalories, avgSpeed, maxSpeed, totalAscent, totalDescent, avgStanceTimePercent, avgStanceTime, maxRunningCadence, intensity, lapTrigger, avgTemperature, maxTemperature, avgFractionalCadence, maxFractionalCadence, totalFractionalCycles, avgPower, minPower, maxPower, sdevPower, avgGroundTime, sdevGroundTime, avgLegSpringStiffness, sdevLegSpringStiffness, avgFormPower, sdevFormPower, avgStrydCadence, sdevStrydCadence, sdevVerticalOscillation, avgPowerRatio, sdevPowerRatio, avgStrideRatio, sdevStrideRatio, activitiesId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
dblaps);
return results;
}
......@@ -7372,7 +7436,7 @@ class DbLap {
Future<int> _upsert() async {
try {
if (await _mnDbLap.rawInsert(
'INSERT OR REPLACE INTO laps (id, timeStamp, startTime, startPositionLat, startPositionLong, endPositionLat, endPositionLong, avgHeartRate, maxHeartRate, avgRunningCadence, event, eventType, eventGroup, sport, subSport, avgVerticalOscillation, totalElapsedTime, totalTimerTime, totalDistance, totalStrides, totalCalories, avgSpeed, maxSpeed, totalAscent, totalDescent, avgStanceTimePercent, avgStanceTime, maxRunningCadence, intensity, lapTrigger, avgTemperature, maxTemperature, avgFractionalCadence, maxFractionalCadence, totalFractionalCycles, avgPower, minPower, maxPower, sdevPower, avgGroundTime, sdevGroundTime, avgLegSpringStiffness, sdevLegSpringStiffness, avgFormPower, sdevFormPower, avgStrydCadence, sdevStrydCadence, sdevVerticalOscillation, activitiesId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
'INSERT OR REPLACE INTO laps (id, timeStamp, startTime, startPositionLat, startPositionLong, endPositionLat, endPositionLong, avgHeartRate, maxHeartRate, avgRunningCadence, event, eventType, eventGroup, sport, subSport, avgVerticalOscillation, totalElapsedTime, totalTimerTime, totalDistance, totalStrides, totalCalories, avgSpeed, maxSpeed, totalAscent, totalDescent, avgStanceTimePercent, avgStanceTime, maxRunningCadence, intensity, lapTrigger, avgTemperature, maxTemperature, avgFractionalCadence, maxFractionalCadence, totalFractionalCycles, avgPower, minPower, maxPower, sdevPower, avgGroundTime, sdevGroundTime, avgLegSpringStiffness, sdevLegSpringStiffness, avgFormPower, sdevFormPower, avgStrydCadence, sdevStrydCadence, sdevVerticalOscillation, avgPowerRatio, sdevPowerRatio, avgStrideRatio, sdevStrideRatio, activitiesId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
[
id,
timeStamp != null ? timeStamp.millisecondsSinceEpoch : null,
......@@ -7422,6 +7486,10 @@ class DbLap {
avgStrydCadence,
sdevStrydCadence,
sdevVerticalOscillation,
avgPowerRatio,
sdevPowerRatio,
avgStrideRatio,
sdevStrideRatio,
activitiesId
]) ==
1) {
......@@ -7447,7 +7515,7 @@ class DbLap {
/// Returns a <List<BoolResult>>
Future<List<BoolResult>> upsertAll(List<DbLap> dblaps) async {
final results = await _mnDbLap.rawInsertAll(
'INSERT OR REPLACE INTO laps (id, timeStamp, startTime, startPositionLat, startPositionLong, endPositionLat, endPositionLong, avgHeartRate, maxHeartRate, avgRunningCadence, event, eventType, eventGroup, sport, subSport, avgVerticalOscillation, totalElapsedTime, totalTimerTime, totalDistance, totalStrides, totalCalories, avgSpeed, maxSpeed, totalAscent, totalDescent, avgStanceTimePercent, avgStanceTime, maxRunningCadence, intensity, lapTrigger, avgTemperature, maxTemperature, avgFractionalCadence, maxFractionalCadence, totalFractionalCycles, avgPower, minPower, maxPower, sdevPower, avgGroundTime, sdevGroundTime, avgLegSpringStiffness, sdevLegSpringStiffness, avgFormPower, sdevFormPower, avgStrydCadence, sdevStrydCadence, sdevVerticalOscillation, activitiesId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
'INSERT OR REPLACE INTO laps (id, timeStamp, startTime, startPositionLat, startPositionLong, endPositionLat, endPositionLong, avgHeartRate, maxHeartRate, avgRunningCadence, event, eventType, eventGroup, sport, subSport, avgVerticalOscillation, totalElapsedTime, totalTimerTime, totalDistance, totalStrides, totalCalories, avgSpeed, maxSpeed, totalAscent, totalDescent, avgStanceTimePercent, avgStanceTime, maxRunningCadence, intensity, lapTrigger, avgTemperature, maxTemperature, avgFractionalCadence, maxFractionalCadence, totalFractionalCycles, avgPower, minPower, maxPower, sdevPower, avgGroundTime, sdevGroundTime, avgLegSpringStiffness, sdevLegSpringStiffness, avgFormPower, sdevFormPower, avgStrydCadence, sdevStrydCadence, sdevVerticalOscillation, avgPowerRatio, sdevPowerRatio, avgStrideRatio, sdevStrideRatio, activitiesId) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',
dblaps);
return results;
}
......@@ -8141,6 +8209,30 @@ class DbLapFilterBuilder extends SearchCriteria {
_sdevVerticalOscillation, 'sdevVerticalOscillation', DbType.real);
}
DbLapField _avgPowerRatio;
DbLapField get avgPowerRatio {
return _avgPowerRatio =
setField(_avgPowerRatio, 'avgPowerRatio', DbType.real);
}
DbLapField _sdevPowerRatio;
DbLapField get sdevPowerRatio {
return _sdevPowerRatio =
setField(_sdevPowerRatio, 'sdevPowerRatio', DbType.real);
}
DbLapField _avgStrideRatio;
DbLapField get avgStrideRatio {
return _avgStrideRatio =
setField(_avgStrideRatio, 'avgStrideRatio', DbType.real);
}
DbLapField _sdevStrideRatio;
DbLapField get sdevStrideRatio {
return _sdevStrideRatio =
setField(_sdevStrideRatio, 'sdevStrideRatio', DbType.real);
}
DbLapField _activitiesId;
DbLapField get activitiesId {
return _activitiesId =
......@@ -8767,6 +8859,30 @@ class DbLapFields {
_fSdevVerticalOscillation, 'sdevVerticalOscillation', DbType.real);
}
static TableField _fAvgPowerRatio;
static TableField get avgPowerRatio {
return _fAvgPowerRatio = _fAvgPowerRatio ??
SqlSyntax.setField(_fAvgPowerRatio, 'avgPowerRatio', DbType.real);
}
static TableField _fSdevPowerRatio;
static TableField get sdevPowerRatio {
return _fSdevPowerRatio = _fSdevPowerRatio ??
SqlSyntax.setField(_fSdevPowerRatio, 'sdevPowerRatio', DbType.real);
}
static TableField _fAvgStrideRatio;
static TableField get avgStrideRatio {
return _fAvgStrideRatio = _fAvgStrideRatio ??
SqlSyntax.setField(_fAvgStrideRatio, 'avgStrideRatio', DbType.real);
}
static TableField _fSdevStrideRatio;
static TableField get sdevStrideRatio {
return _fSdevStrideRatio = _fSdevStrideRatio ??
SqlSyntax.setField(_fSdevStrideRatio, 'sdevStrideRatio', DbType.real);
}
static TableField _fActivitiesId;
static TableField get activitiesId {
return _fActivitiesId = _fActivitiesId ??
......
......@@ -211,6 +211,15 @@ class Activity extends ChangeNotifier {
for (Lap lap in laps) {
var records = await lap.records;
lap.db.avgPower = Lap.calculateAveragePower(records: records);
lap.db.avgFormPower = Lap.calculateAverageFormPower(records: records);
lap.db.avgHeartRate = Lap.calculateAverageHeartRate(records: records);
lap.db.avgSpeed = Lap.calculateAverageSpeed(records: records);
lap.db.avgGroundTime = Lap.calculateAverageGroundTime(records: records);
lap.db.avgStrydCadence = Lap.calculateAverageStrydCadence(records: records);
lap.db.avgLegSpringStiffness = Lap.calculateAverageLegSpringStiffness(records: records);
lap.db.avgStrideRatio = Lap.calculateAverageStrideRatio(records: records);
lap.db.avgPowerRatio = Lap.calculateAverageStrideRatio(records: records);
lap.db.avgVerticalOscillation = Lap.calculateAverageVerticalOscillation(records: records);
await lap.db.save();
}
await db.save();
......
......@@ -278,6 +278,45 @@ class Lap {
return 0;
}
static int calculateAverageHeartRate({List<Event> records}) {
var heartRates = records
.where((record) =>
record.db.heartRate != null &&
record.db.heartRate > 0 &&
record.db.heartRate < 2000)
.map((record) => record.db.heartRate);
if (heartRates.length > 0) {
return heartRates.mean().round();
} else
return -1;
}
static double calculateSdevHeartRate({List<Event> records}) {
var heartRates = records
.where((record) =>
record.db.heartRate != null &&
record.db.heartRate > 0 &&
record.db.heartRate < 2000)
.map((record) => record.db.heartRate);
return heartRates.sdev();
}
static int calculateMinHeartRate({List<Event> records}) {
var heartRates = records.map((record) => record.db.heartRate).nonZeroInts();
if (heartRates.length > 0)
return heartRates.min();
else
return 0;
}
static int calculateMaxHeartRate({List<Event> records}) {
var heartRates = records.map((record) => record.db.heartRate).nonZeroInts();
if (heartRates.length > 0)
return heartRates.max();
else
return 0;
}
static double calculateAverageSpeed({List<Event> records}) {
var speeds = records.map((record) => record.db.speed).nonZeroDoubles();
if (speeds.length > 0) {
......
......@@ -18,9 +18,14 @@ class ActivityMetadataWidget extends StatelessWidget {
Widget build(context) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
children: <Widget>[
child: GridView.count(
padding: EdgeInsets.all(5),
crossAxisCount:
MediaQuery.of(context).orientation == Orientation.portrait ? 2 : 4,
childAspectRatio: 3,
crossAxisSpacing: 3,
mainAxisSpacing: 3,
children: [
ListTile(
leading: MyIcon.title,
title: Text(activity.db.name),
......@@ -57,12 +62,12 @@ class ActivityMetadataWidget extends StatelessWidget {
),
ListTile(
leading: MyIcon.verticalOscillation,
title: Text(activity.db.avgVerticalOscillation.toString()),
title: Text(activity.db.avgVerticalOscillation.toStringAsFixed(2)),
subtitle: Text('avg vertical oscillation'),
),
ListTile(
leading: MyIcon.cycles,
title: Text(activity.db.totalFractionalCycles.toString()),
title: Text(activity.db.totalFractionalCycles.toStringAsFixed(2)),
subtitle: Text('total fractional cycles'),
),
ListTile(
......@@ -118,22 +123,25 @@ class ActivityMetadataWidget extends StatelessWidget {
ListTile(
leading: MyIcon.position,
title: Text(activity.db.startPositionLong.semicirclesAsDegrees() +
" / " +
activity.db.startPositionLat.semicirclesAsDegrees()),
" E\n" +
activity.db.startPositionLat.semicirclesAsDegrees() +
" N"),
subtitle: Text('start position'),
),
ListTile(
leading: MyIcon.position,
title: Text(activity.db.necLong.semicirclesAsDegrees() +
" / " +
activity.db.necLat.semicirclesAsDegrees()),
" E\n" +
activity.db.necLat.semicirclesAsDegrees() +
" N"),
subtitle: Text('north east corner'),
),
ListTile(
leading: MyIcon.position,
title: Text(activity.db.swcLong.semicirclesAsDegrees() +
" / " +
activity.db.swcLat.semicirclesAsDegrees()),
" E\n" +
activity.db.swcLat.semicirclesAsDegrees() +
" N"),
subtitle: Text('south west corner'),
),
ListTile(
......
......@@ -31,9 +31,13 @@ class _ActivityOverviewWidgetState extends State<ActivityOverviewWidget> {
Widget build(context) {
return ListTileTheme(
iconColor: Colors.deepOrange,
child: ListView(
padding: EdgeInsets.only(left: 25),
children: <Widget>[
child: GridView.count(
padding: EdgeInsets.all(5),
crossAxisCount: MediaQuery.of(context).orientation == Orientation.portrait ? 2 : 4,
childAspectRatio: 3,
crossAxisSpacing: 3,
mainAxisSpacing: 3,
children: [
ListTile(
leading: MyIcon.time,
title: Text(Duration(seconds: widget.activity.db.movingTime ?? 0)
......
......@@ -11,11 +11,16 @@ class LapMetadataWidget extends StatelessWidget {
@override
Widget build(context) {
return ListTileTheme(
return ListTileTheme(
iconColor: Colors.lightGreen,
child: ListView(
padding: EdgeInsets.only(left: 25),
children: <Widget>[
child: GridView.count(
padding: EdgeInsets.all(5),
crossAxisCount:
MediaQuery.of(context).orientation == Orientation.portrait ? 2 : 4,
childAspectRatio: 3,
crossAxisSpacing: 3,
mainAxisSpacing: 3,
children: [
ListTile(
leading: MyIcon.repeats,
title: Text('Lap ${lap.index}'),
......@@ -44,7 +49,7 @@ class LapMetadataWidget extends StatelessWidget {
),
ListTile(
leading: MyIcon.verticalOscillation,
title: Text(lap.db.avgVerticalOscillation.toString()),
title: Text(lap.db.avgVerticalOscillation.toStringAsFixed(2)),
subtitle: Text('avg vertical oscillation'),
),
ListTile(
......@@ -83,21 +88,23 @@ class LapMetadataWidget extends StatelessWidget {
),
ListTile(
leading: MyIcon.repeats,
title: Text(lap.db.totalFractionalCycles.toString()),
title: Text(lap.db.totalFractionalCycles.toStringAsFixed(2)),
subtitle: Text('total fractional cycles'),
),
ListTile(
leading: MyIcon.position,
title: Text(lap.db.startPositionLong.semicirclesAsDegrees() +
" / " +
lap.db.startPositionLat.semicirclesAsDegrees()),
" E\n" +
lap.db.startPositionLat.semicirclesAsDegrees() +
" N"),
subtitle: Text('start position'),
),
ListTile(
leading: MyIcon.position,
title: Text(lap.db.endPositionLong.semicirclesAsDegrees() +
" / " +
lap.db.endPositionLat.semicirclesAsDegrees()),
" E\n" +
lap.db.endPositionLat.semicirclesAsDegrees() +
" N"),
subtitle: Text('end position'),
),
ListTile(
......
......@@ -13,9 +13,13 @@ class LapOverviewWidget extends StatelessWidget {
Widget build(context) {
return ListTileTheme(
iconColor: Colors.lightGreen,
child: ListView(
padding: EdgeInsets.only(left: 25),
children: <Widget>[
child: GridView.count(
padding: EdgeInsets.all(5),
crossAxisCount: MediaQuery.of(context).orientation == Orientation.portrait ? 2 : 4,
childAspectRatio: 3,
crossAxisSpacing: 3,
mainAxisSpacing: 3,
children: [
ListTile(
leading: MyIcon.speed,
title: Text(lap.db.avgSpeed.toPace() + " / " + lap.db.maxSpeed.toPace()),
......@@ -36,7 +40,7 @@ class LapOverviewWidget extends StatelessWidget {
ListTile(
leading: MyIcon.power,
title:
Text("${(lap.db.avgPower / lap.db.avgHeartRate).toStringAsFixed(2)} WW/bpm"),
Text("${(lap.db.avgPower / lap.db.avgHeartRate).toStringAsFixed(2)} W/bpm"),
subtitle: Text('power / heart rate'),
),
ListTile(
......
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