Commit ff13fdbd authored by Administrator's avatar Administrator

show at least 40 activities on athlete level

parent 75868466
......@@ -24,16 +24,26 @@ class _AthleteEcorWidgetState extends State<AthleteEcorWidget> {
@override
Widget build(context) {
if (activities.length > 0) {
if (activities.length == 0) {
return Center(
child: Text("Loading"),
);
} else {
var ecorActivities = activities
.where((activity) =>
activity.db.avgPower != null &&
activity.db.avgPower > 0 &&
activity.db.avgSpeed != null &&
activity.weight != null)
activity.db.avgSpeed != null)
.toList();
if (ecorActivities.length > 0) {
if (ecorActivities.length == 0) {
return Center(
child: Text("No ecor data available."),
);
} else if (ecorActivities.first.weight == null) {
return Center(
child: Text("Please enter your (historical) weight in the settings."),
);
} else {
return ListTileTheme(
iconColor: Colors.orange,
child: ListView(
......@@ -43,15 +53,7 @@ class _AthleteEcorWidgetState extends State<AthleteEcorWidget> {
],
),
);
} else {
return Center(
child: Text("No Ecor available."),
);
}
} else {
return Center(
child: Text("Loading"),
);
}
}
......@@ -64,7 +66,7 @@ class _AthleteEcorWidgetState extends State<AthleteEcorWidget> {
athletesId: activity.db.athletesId,
date: activity.db.timeCreated,
);
activity.weight = weight.db.value;
activity.weight = weight?.db?.value;
}
setState(() {});
}
......
import 'dart:math';
import 'package:charts_flutter/flutter.dart';
import 'package:encrateia/models/activity_list.dart';
import 'package:flutter/material.dart';
......@@ -23,6 +25,10 @@ class AthleteEcorChart extends StatelessWidget {
DateTime.now().difference(activity.db.timeCreated).inDays <
xAxesDays)
.toList();
if (recentActivities.length < 40) {
int amount = min(activities.length, 40);
recentActivities = activities.sublist(0, amount);
}
var data = [
Series<Activity, DateTime>(
......
import 'dart:math';
import 'package:charts_flutter/flutter.dart';
import 'package:encrateia/models/activity_list.dart';
import 'package:flutter/material.dart';
......@@ -23,6 +25,10 @@ class AthletePowerChart extends StatelessWidget {
DateTime.now().difference(activity.db.timeCreated).inDays <
xAxesDays)
.toList();
if (recentActivities.length < 40) {
int amount = min(activities.length, 40);
recentActivities = activities.sublist(0, amount);
}
var data = [
Series<Activity, DateTime>(
......
import 'dart:math';
import 'package:charts_flutter/flutter.dart';
import 'package:flutter/material.dart';
import 'package:encrateia/models/activity.dart';
......@@ -23,6 +25,10 @@ class AthletePowerPerHeartRateChart extends StatelessWidget {
DateTime.now().difference(activity.db.timeCreated).inDays <
xAxesDays)
.toList();
if (recentActivities.length < 40) {
int amount = min(activities.length, 40);
recentActivities = activities.sublist(0, amount);
}
var data = [
Series<Activity, DateTime>(
......
import 'dart:math';
import 'package:charts_flutter/flutter.dart';
import 'package:flutter/material.dart';
import 'package:encrateia/models/activity.dart';
......@@ -23,6 +25,10 @@ class AthletePowerRatioChart extends StatelessWidget {
DateTime.now().difference(activity.db.timeCreated).inDays <
xAxesDays)
.toList();
if (recentActivities.length < 40) {
int amount = min(activities.length, 40);
recentActivities = activities.sublist(0, amount);
}
var data = [
Series<Activity, DateTime>(
......
import 'dart:math';
import 'package:charts_flutter/flutter.dart';
import 'package:flutter/material.dart';
import 'package:encrateia/models/activity.dart';
......@@ -23,6 +25,10 @@ class AthleteSpeedPerHeartRateChart extends StatelessWidget {
DateTime.now().difference(activity.db.timeCreated).inDays <
xAxesDays)
.toList();
if (recentActivities.length < 40) {
int amount = min(activities.length, 40);
recentActivities = activities.sublist(0, amount);
}
var data = [
Series<Activity, DateTime>(
......
import 'dart:math';
import 'package:charts_flutter/flutter.dart';
import 'package:flutter/material.dart';
import 'package:encrateia/models/activity.dart';
......@@ -23,6 +25,10 @@ class AthleteStrideRatioChart extends StatelessWidget {
DateTime.now().difference(activity.db.timeCreated).inDays <
xAxesDays)
.toList();
if (recentActivities.length < 40) {
int amount = min(activities.length, 40);
recentActivities = activities.sublist(0, amount);
}
var data = [
Series<Activity, DateTime>(
......
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