Skip to content

Commit 066d643

Browse files
committed
Refactor the data model for multi-value categories
Measurement categories can optionally point to another category, In practice, this will just be something like blood pressure since these values only make sense in a pair. Others can be interesting while combined (heart rate and steps), but are valid on their own.
1 parent 8aac3da commit 066d643

20 files changed

Lines changed: 702 additions & 24 deletions

lib/core/widgets/dashboard/widgets/measurements.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ class _DashboardMeasurementWidgetState extends ConsumerState<DashboardMeasuremen
4545
return AsyncValueWidget<List<MeasurementCategory>>(
4646
value: ref.watch(measurementProvider),
4747
loggerName: 'DashboardMeasurementWidget',
48-
data: (categoriesList) {
48+
data: (allCategories) {
49+
// Children of multi-value groups are shown inside their parent's card
50+
final categoriesList = allCategories.where((c) => c.parentId == null).toList();
51+
4952
if (categoriesList.isEmpty) {
5053
return NothingFound(
5154
AppLocalizations.of(context).moreMeasurementEntries,

0 commit comments

Comments
 (0)