feat(dashboard, api): integrate BMI thresholds and enhance dashboard with health metrics
This commit is contained in:
@@ -2,6 +2,8 @@ import React from 'react';
|
||||
|
||||
import { Clock, TrendingUp, User } from 'lucide-react';
|
||||
|
||||
import { bmiFromMetric } from '~/lib/utils';
|
||||
|
||||
import { TeamAccountStatisticsProps } from '../../_components/team-account-statistics';
|
||||
|
||||
interface AccountHealthDetailsField {
|
||||
@@ -26,9 +28,7 @@ export const getAccountHealthDetailsFields = (
|
||||
): AccountHealthDetailsField[] => {
|
||||
const averageBMI = (
|
||||
memberParams.reduce((sum, { height, weight }) => {
|
||||
const hMeters = height! / 100;
|
||||
const bmi = weight! / (hMeters * hMeters);
|
||||
return sum + bmi;
|
||||
return bmiFromMetric(weight ?? 0, height ?? 0) + sum;
|
||||
}, 0) / memberParams.length
|
||||
).toFixed(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user