Skip to content

Commit

Permalink
Sort exercises alphabetically in dropdown in vizualization tab (#210)
Browse files Browse the repository at this point in the history
* Sort exercises alphabetically in dropdown in viz tab

* Linted code
  • Loading branch information
andreped authored Aug 24, 2024
1 parent 947c289 commit 4388b22
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/tabs/visualization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,18 @@ class _VisualizationTabState extends State<VisualizationTab> {
variables = await _dbHelper.getFitnessData();
}

// fetch data from table
final names = variables
.map((entry) => entry['exercise'] as String)
.toSet()
.toList();

// sort names if not empty
if (!names.isEmpty) {
names.sort();
}

// update states
setState(() {
_exerciseNames = names;
if (_selectedExercise != null) {
Expand Down

0 comments on commit 4388b22

Please sign in to comment.