Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add lean body mass as a metric type

Roland Geider02653d139544
diff --git a/wger/measurements/limits.py b/wger/measurements/limits.py
index c84b1f6ee..dff287c17 100644
--- a/wger/measurements/limits.py
+++ b/wger/measurements/limits.py
@@ -72,6 +72,8 @@ METRIC_LIMITS: dict[str, dict[str | None, Limits]] = {
None: _BODY_WEIGHT_KG,
},
MetricType.BODY_FAT: {None: Limits(Decimal(2), Decimal(60), Decimal(5), Decimal(50))},
+ # Always below the body weight it is part of, so the floor can sit lower
+ MetricType.LEAN_BODY_MASS: {None: Limits(Decimal(10), Decimal(250), Decimal(30), Decimal(90))},
MetricType.HEIGHT: {None: Limits(Decimal(50), Decimal(250), Decimal(140), Decimal(210))},
MetricType.BLOOD_PRESSURE_SYSTOLIC: {
None: Limits(Decimal(50), Decimal(250), Decimal(90), Decimal(180)),
diff --git a/wger/measurements/migrations/0006_health_sync.py b/wger/measurements/migrations/0006_health_sync.py
index c428cec55..2df60370a 100644
--- a/wger/measurements/migrations/0006_health_sync.py
+++ b/wger/measurements/migrations/0006_health_sync.py
@@ -40,6 +40,7 @@ class Migration(migrations.Migration):
('custom', 'Custom'),
('body_weight', 'Body Weight'),
('body_fat', 'Body Fat'),
+ ('lean_body_mass', 'Lean Body Mass'),
('height', 'Height'),
('blood_pressure', 'Blood Pressure'),
('blood_pressure_systolic', 'Blood Pressure Systolic'),
diff --git a/wger/measurements/models/category.py b/wger/measurements/models/category.py
index d3ae80fdb..41f146525 100644
--- a/wger/measurements/models/category.py
+++ b/wger/measurements/models/category.py
@@ -32,6 +32,7 @@ class MetricType(models.TextChoices):
CUSTOM = 'custom' # free-form, no mapping
BODY_WEIGHT = 'body_weight'
BODY_FAT = 'body_fat'
+ LEAN_BODY_MASS = 'lean_body_mass'
HEIGHT = 'height'
BLOOD_PRESSURE = 'blood_pressure'
BLOOD_PRESSURE_SYSTOLIC = 'blood_pressure_systolic'