mitai-jinkendo/frontend/src/widgetSystem/dashboardChartUtils.js
Lars ddc87ba5ae
All checks were successful
Deploy Development / deploy (push) Successful in 56s
Build Test / pytest-backend (push) Successful in 5s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s
feat: remove deprecated demo route and enhance dashboard widget registration
- Removed outdated visualization demo route and fixed demo layout in the frontend.
- Updated widget registration logic in `frontend/src/widgetSystem/registerDashboardWidgets.js` to ensure proper integration of core widgets.
- Adjusted documentation in `.claude/docs/technical/DASHBOARD_WIDGETS_AGENT_GUIDE.md` and comments in `backend/widget_catalog.py` to reflect changes.
- Added new dashboard widgets for activity and body overview, enhancing user experience and data visualization capabilities.
- Bumped application version to reflect these changes.
2026-04-23 15:24:13 +02:00

17 lines
484 B
JavaScript

import dayjs from 'dayjs'
/** Gleiche Logik wie History.jsx für rollierende Mittel */
export function rollingAvg(arr, key, window = 7) {
return arr.map((d, i) => {
const s = arr
.slice(Math.max(0, i - window + 1), i + 1)
.map((x) => x[key])
.filter((v) => v != null)
return s.length
? { ...d, [`${key}_avg`]: Math.round((s.reduce((a, b) => a + b, 0) / s.length) * 10) / 10 }
: d
})
}
export const fmtDate = (d) => dayjs(d).format('DD.MM')