Etapp 1: kroppsdata synkas mot servern + BMR + dagens kcal-mätare på Hem
All checks were successful
release / build-release (push) Successful in 5m54s

- Profile/myProfile med heightCm/birthYear/sex (fallback mot äldre server),
  updateProfile-mutation i GymApi
- Kroppsdata sparas lokalt och synkas: serverns värden vinner, lokala pushas
  upp om servern är tom (migrerar vågens lokala data)
- Mifflin–St Jeor-BMR (data/Bmr.kt)
- Hemskärm: Dagens kalorier-kort — aktivt loggat (dagens pass), telefonen
  (platshållare för etapp 5) och passivt (BMR-andel av dygnet, tickar per
  minut). Uppmaning om kroppsdata saknas.
- Version 0.5.0

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C2GA94E1f3cmrvdQLQhYdg
This commit is contained in:
2026-08-23 17:20:39 +02:00
parent 9784b749aa
commit 06b2f0ec86
7 changed files with 261 additions and 6 deletions

View File

@@ -0,0 +1,20 @@
package eu.brassepc.fitnessdroid.data
import java.time.LocalDate
/**
* Basalmetabolism (kcal/dygn) enligt MifflinSt Jeor:
* 10·vikt + 6.25·längd 5·ålder + 5 (man) / 161 (kvinna).
* null om något av underlagen saknas.
*/
fun bmrKcalPerDay(
weightKg: Double?,
heightCm: Double?,
birthYear: Int?,
isFemale: Boolean?,
): Double? {
if (weightKg == null || heightCm == null || birthYear == null || isFemale == null) return null
val age = (LocalDate.now().year - birthYear).coerceIn(0, 120)
val k = if (isFemale) -161.0 else 5.0
return 10.0 * weightKg + 6.25 * heightCm - 5.0 * age + k
}