Commit e49effe2 authored by Administrator's avatar Administrator

cleaning up naming

parent 01be3376
......@@ -63,7 +63,7 @@ const SqfEntityTable tableActivity = SqfEntityTable(
SqfEntityField('totalCalories', DbType.integer),
SqfEntityField('avgSpeed', DbType.real),
SqfEntityField('avgSpeedByMeasurements', DbType.real),
SqfEntityField('avgSpeedByTime', DbType.real),
SqfEntityField('avgSpeedBySpeed', DbType.real),
SqfEntityField('avgSpeedByDistance', DbType.real),
SqfEntityField('sdevSpeed', DbType.real),
SqfEntityField('sdevPace', DbType.real),
......@@ -194,7 +194,7 @@ const SqfEntityTable tableLap = SqfEntityTable(
SqfEntityField('totalCalories', DbType.integer),
SqfEntityField('avgSpeed', DbType.real),
SqfEntityField('avgSpeedByMeasurements', DbType.real),
SqfEntityField('avgSpeedByTime', DbType.real),
SqfEntityField('avgSpeedBySpeed', DbType.real),
SqfEntityField('avgSpeedByDistance', DbType.real),
SqfEntityField('sdevSpeed', DbType.real),
SqfEntityField('sdevPace', DbType.real),
......@@ -257,7 +257,7 @@ const SqfEntityTable tableInterval = SqfEntityTable(
SqfEntityField('sdevPower', DbType.real),
SqfEntityField('avgSpeed', DbType.real),
SqfEntityField('avgSpeedByMeasurements', DbType.real),
SqfEntityField('avgSpeedByTime', DbType.real),
SqfEntityField('avgSpeedBySpeed', DbType.real),
SqfEntityField('avgSpeedByDistance', DbType.real),
SqfEntityField('minSpeed', DbType.real),
SqfEntityField('maxSpeed', DbType.real),
......
This diff is collapsed.
......@@ -88,7 +88,7 @@ class Activity {
double get avgRunningCadence => _db.avgRunningCadence;
double get avgSpeed => _db.avgSpeed;
double get avgSpeedByMeasurements => _db.avgSpeedByMeasurements;
double get avgSpeedByTime => _db.avgSpeedByTime;
double get avgSpeedBySpeed => _db.avgSpeedBySpeed;
double get avgSpeedByDistance => _db.avgSpeedByDistance;
double get avgStanceTime => _db.avgStanceTime;
double get avgStanceTimePercent => _db.avgStanceTimePercent;
......@@ -304,7 +304,7 @@ class Activity {
..minHeartRate = recordList.minHeartRate()
..maxHeartRate = recordList.maxHeartRate()
..avgSpeedByMeasurements = recordList.avgSpeedByMeasurements()
..avgSpeedByTime = recordList.avgSpeedBySpeed()
..avgSpeedBySpeed = recordList.avgSpeedBySpeed()
..avgSpeedByDistance = recordList.avgSpeedByDistance()
..sdevSpeed = recordList.sdevSpeed()
..sdevPace = recordList.sdevPace()
......
......@@ -93,7 +93,7 @@ class Interval {
..minHeartRate = recordList.minHeartRate()
..maxHeartRate = recordList.maxHeartRate()
..avgSpeedByMeasurements = recordList.avgSpeedByMeasurements()
..avgSpeedByTime = recordList.avgSpeedBySpeed()
..avgSpeedBySpeed = recordList.avgSpeedBySpeed()
..avgSpeedByDistance = recordList.avgSpeedByDistance()
..sdevSpeed = recordList.sdevSpeed()
..sdevPace = recordList.sdevPace()
......
......@@ -51,7 +51,7 @@ class Lap {
double get avgRunningCadence => _db.avgRunningCadence;
double get avgSpeed => _db.avgSpeed;
double get avgSpeedByMeasurements => _db.avgSpeedByMeasurements;
double get avgSpeedByTime => _db.avgSpeedByTime;
double get avgSpeedBySpeed => _db.avgSpeedBySpeed;
double get avgSpeedByDistance => _db.avgSpeedByDistance;
double get avgStanceTime => _db.avgStanceTime;
double get avgStanceTimePercent => _db.avgStanceTimePercent;
......@@ -192,7 +192,7 @@ class Lap {
..minHeartRate = recordList.minHeartRate()
..maxHeartRate = recordList.maxHeartRate()
..avgSpeedByMeasurements = recordList.avgSpeedByMeasurements()
..avgSpeedByTime = recordList.avgSpeedBySpeed()
..avgSpeedBySpeed = recordList.avgSpeedBySpeed()
..avgSpeedByDistance = recordList.avgSpeedByDistance()
..sdevSpeed = recordList.sdevSpeed()
..sdevPace = recordList.sdevPace()
......
......@@ -90,14 +90,14 @@ class RecordList<E> extends DelegatingList<E> {
final Map<DateTime, double> speedMap = <DateTime, double>{
for (final Event record in _records) record.timeStamp: record.speed
};
return speedMap.meanBySpeed();
return speedMap.meanUsingSpeed();
}
double avgSpeedByDistance() {
final Map<DateTime, double> speedMap = <DateTime, double>{
for (final Event record in _records) record.timeStamp: record.distance,
};
return speedMap.meanByDistance();
return speedMap.meanUsingDistance();
}
double sdevSpeed() => _records
......
extension StatisticFunctions on Map<DateTime, double> {
double meanByTime() {
double meanWeightedOverTime() {
double sumOfValues = 0;
double sumOfWeights = 0;
......@@ -17,7 +17,7 @@ extension StatisticFunctions on Map<DateTime, double> {
return sumOfValues / sumOfWeights;
}
double meanByDistanceAlt() {
double meanWeightedOverDistance() {
double sumOfValues = 0;
double sumOfWeights = 0;
......@@ -36,7 +36,7 @@ extension StatisticFunctions on Map<DateTime, double> {
return sumOfValues / sumOfWeights;
}
double meanByDistance() {
double meanUsingDistance() {
double sumOfValues = 0;
double sumOfWeights = 0;
......@@ -48,17 +48,18 @@ extension StatisticFunctions on Map<DateTime, double> {
? timeStamp.difference(lastTimeStamp).inSeconds
: 0;
final double distanceEvolved = lastDistance != null
? lastDistance - distance
? distance - lastDistance
: 0;
sumOfValues += distanceEvolved;
sumOfWeights += timeEvolved;
lastTimeStamp = timeStamp;
lastDistance = distance;
});
return sumOfValues / sumOfWeights;
}
double meanBySpeed() {
double meanUsingSpeed() {
double sumOfValues = 0;
double sumOfWeights = 0;
......
......@@ -23,7 +23,7 @@ class _ActivitySpeedWidgetState extends State<ActivitySpeedWidget> {
RecordList<Event> records = RecordList<Event>(<Event>[]);
String avgSpeedString = 'Loading ...';
String avgSpeedByMeasurementsString = 'Loading ...';
String avgSpeedByTimeString = 'Loading ...';
String avgSpeedBySpeedString = 'Loading ...';
String avgSpeedByDistanceString = 'Loading ...';
String sdevSpeedString = 'Loading ...';
......@@ -64,22 +64,22 @@ class _ActivitySpeedWidgetState extends State<ActivitySpeedWidget> {
ListTile(
leading: MyIcon.average,
title: Text(avgSpeedString),
subtitle: const Text('average speed from .fit-file'),
subtitle: const Text('average speed (from .fit-file)'),
),
ListTile(
leading: MyIcon.average,
title: Text(avgSpeedByMeasurementsString),
subtitle: const Text('average speed by measurements'),
subtitle: const Text('average speed (average over measurements)'),
),
ListTile(
leading: MyIcon.average,
title: Text(avgSpeedByTimeString),
subtitle: const Text('average speed by time'),
title: Text(avgSpeedBySpeedString),
subtitle: const Text('average speed (using speed data points)'),
),
ListTile(
leading: MyIcon.average,
title: Text(avgSpeedByDistanceString),
subtitle: const Text('average speed by distance'),
subtitle: const Text('average speed (using distance data points)'),
),
ListTile(
leading: MyIcon.standardDeviation,
......@@ -115,8 +115,8 @@ class _ActivitySpeedWidgetState extends State<ActivitySpeedWidget> {
avgSpeedByMeasurementsString = activity.avgSpeedByMeasurements != null
? (activity.avgSpeedByMeasurements * 3.6).toStringAsFixed(2) + 'km/h'
: '- - -';
avgSpeedByTimeString = activity.avgSpeedByTime != null
? (activity.avgSpeedByTime * 3.6).toStringAsFixed(2) + 'km/h'
avgSpeedBySpeedString = activity.avgSpeedBySpeed != null
? (activity.avgSpeedBySpeed * 3.6).toStringAsFixed(2) + 'km/h'
: '- - -';
avgSpeedByDistanceString = activity.avgSpeedByDistance != null
? (activity.avgSpeedByDistance * 3.6).toStringAsFixed(2) + 'km/h'
......
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