Commit 2589d1be authored by Stefan Haslinger's avatar Stefan Haslinger

bugfix: show only views available on lap level

parent e6daeabf
......@@ -146,6 +146,21 @@ class Lap {
return null;
}
// easier check for data availability
bool get powerAvailable => !<num>[null, -1].contains(avgPower);
bool get heartRateAvailable => !<num>[null, -1].contains(avgHeartRate);
bool get ascentAvailable => totalAscent != null && totalDescent != null;
bool get cadenceAvailable => !<num>[null, -1].contains(avgStrydCadence);
bool get speedAvailable => !<num>[null, 0, -1].contains(avgSpeed);
bool get weightAvailable => !<num>[null, 0].contains(weight);
bool get paceAvailable => !<num>[null, -1].contains(avgPace);
bool get ecorAvailable => !<num>[null, -1].contains(ecor);
bool get groundTimeAvailable => !<num>[null, -1].contains(avgGroundTime);
bool get formPowerAvailable => !<num>[null, -1].contains(avgFormPower);
bool get verticalOscillationAvailable => !<num>[null, -1].contains(avgVerticalOscillation);
bool get strideCadenceAvailable => !<num>[null, -1].contains(avgDoubleStrydCadence);
bool get legSpringStiffnessAvailable => !<num>[null, -1].contains(avgLegSpringStiffness);
Future<BoolResult> delete() async => await _db.delete();
Future<int> save() async => await _db.save();
......
......@@ -42,7 +42,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapOverviewWidget(lap: lap, athlete: athlete ),
),
if (lap.avgHeartRate != null)
if (lap.heartRateAvailable)
navigationButton(
title: 'Heart Rate',
color: MyColor.navigate,
......@@ -50,7 +50,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapHeartRateWidget(lap: lap),
),
if (lap.avgPower != null)
if (lap.powerAvailable)
navigationButton(
title: 'Power',
color: MyColor.navigate,
......@@ -58,7 +58,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapPowerWidget(lap: lap),
),
if (lap.avgPower != null)
if (lap.powerAvailable)
navigationButton(
title: 'Power Duration',
color: MyColor.navigate,
......@@ -66,7 +66,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapPowerDurationWidget(lap: lap),
),
if (lap.avgSpeed != null)
if (lap.paceAvailable)
navigationButton(
title: 'Pace',
color: MyColor.navigate,
......@@ -74,7 +74,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapPaceWidget(lap: lap),
),
if (lap.avgSpeed != null)
if (lap.speedAvailable)
navigationButton(
title: 'Speed',
color: MyColor.navigate,
......@@ -82,7 +82,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapSpeedWidget(lap: lap),
),
if (lap.avgSpeed != null && lap.avgPower != null)
if (lap.speedAvailable && lap.powerAvailable)
navigationButton(
title: 'Ecor',
color: MyColor.navigate,
......@@ -93,7 +93,7 @@ class ShowLapScreen extends StatelessWidget {
athlete: athlete,
),
),
if (lap.avgGroundTime != null)
if (lap.groundTimeAvailable)
navigationButton(
title: 'Ground Time',
color: MyColor.navigate,
......@@ -101,7 +101,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapGroundTimeWidget(lap: lap),
),
if (lap.avgLegSpringStiffness != null)
if (lap.groundTimeAvailable)
navigationButton(
title: 'Leg Spring Stiffness',
color: MyColor.navigate,
......@@ -109,7 +109,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapLegSpringStiffnessWidget(lap: lap),
),
if (lap.avgFormPower != null)
if (lap.formPowerAvailable)
navigationButton(
title: 'Form Power',
color: MyColor.navigate,
......@@ -117,7 +117,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapFormPowerWidget(lap: lap),
),
if (lap.avgStrydCadence != null)
if (lap.cadenceAvailable)
navigationButton(
title: 'Cadence',
color: MyColor.navigate,
......@@ -125,7 +125,7 @@ class ShowLapScreen extends StatelessWidget {
context: context,
nextWidget: ({Lap lap}) => LapStrydCadenceWidget(lap: lap),
),
if (lap.avgVerticalOscillation != null)
if (lap.verticalOscillationAvailable)
navigationButton(
title: 'Vertical Oscillation',
color: MyColor.navigate,
......
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