Skip to content

WIP - feat(measurements): add category grouping and dynamic formula support#1200

Open
pankaj-basnet wants to merge 2 commits into
wger-project:masterfrom
pankaj-basnet:feature/dynamic-measurements-category
Open

WIP - feat(measurements): add category grouping and dynamic formula support#1200
pankaj-basnet wants to merge 2 commits into
wger-project:masterfrom
pankaj-basnet:feature/dynamic-measurements-category

Conversation

@pankaj-basnet

Copy link
Copy Markdown
Contributor

Summary

This PR adapts the Flutter client to two planned (ongoing) backend capabilities given below:

  1. Category Grouping (Planned PR) — Measurement categories can now be linked to a MeasurementGroup via a foreign key on the backend. For example, a "Blood Pressure" group can contain both a "Systolic" and a "Diastolic" category, letting the app surface them together.
  2. Dynamic / Formula-calculated Categories (Ongoing PR) — The /api/v2/measurement/ action endpoint returns auto-computed entries (e.g., BMI derived from body weight + height) as well as the current user's created ones. The Flutter client now routes requests for such categories to this endpoint and enforces a read-only UI so users cannot accidentally add or edit auto-computed values.

What changed

Layer File Change
Model measurement_group.dart New model for measurement groups
Model measurement_category.dart Added groupId, groupDetail, formula, and dynamicParams
Provider measurement.dart Group CRUD, updated editCategory signature
Screen measurement_categories_screen.dart Group filter chips
Screen measurement_entries_screen.dart Read-only scaffold for dynamic categories
Widget categories.dart Group-aware filtering in list
Widget categories_card.dart Group chip + auto-calculated badge
Widget entries.dart Hide edit/delete options for dynamic entries
Widget forms.dart Group + formula dropdowns in category form
Mock data mock_measurement_data.dart Rich dummy data for UI development

Related Issue(s)

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Set a 100-character limit to avoid white space diffs (run dart format .)

UI Screenshots

@rolandgeider

Copy link
Copy Markdown
Member

FYI, since we're getting close to finishing a big release (see e.g. #1183), I'm moving this to the next version 2.7 since the dynamic measurements come with some changes to the backend and frontend and I'd be more comfortable with some time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants