- 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.
17 lines
484 B
JavaScript
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')
|