docs: Task 12 预览样例数据按指标取值、Task 14 补推送核对与 BOM 版本

This commit is contained in:
2026-09-10 11:33:23 +08:00
parent 706b2797ff
commit c9b1070869
@@ -4380,11 +4380,14 @@ private fun StatLine(label: String, value: Double, modifier: Modifier = Modifier
/** 空列表时返回 0.0,避免 NaN。 */
private fun List<Double>.averageOrZero(): Double = if (isEmpty()) 0.0 else average()
/** 睡眠指标的样例数据,供下面两个 Preview 共用。 */
private fun previewSleepPoints(): List<MetricPoint> {
/**
* Preview 用的样例数据:7 个点、每天一个、值从 `base` 起小幅递增。
* 取值贴近区间下限,好让柱状图有高低差、统计摘要的三行数字不相等(都相等就看不出渲染问题)。
*/
private fun previewPoints(base: Double): List<MetricPoint> {
val dayMillis = 24L * 60 * 60 * 1000
val base = 1_700_000_000_000L
return List(7) { index -> MetricPoint(timestamp = base + index * dayMillis, value = 420.0 + index * 12) }
val start = 1_700_000_000_000L
return List(7) { index -> MetricPoint(timestamp = start + index * dayMillis, value = base + index * 12) }
}
/**
@@ -4400,7 +4403,7 @@ private fun MetricDetailContentSleepPreview() {
loading = false,
metric = MetricType.SLEEP,
range = DateRange.WEEK,
points = previewSleepPoints(),
points = previewPoints(base = 420.0), // 睡眠时长(分钟),与 Mock 的 330~510 同量级
),
onBack = {},
onSelectRange = {},
@@ -4421,7 +4424,7 @@ private fun MetricDetailContentStepsPreview() {
loading = false,
metric = MetricType.STEP,
range = DateRange.WEEK,
points = previewSleepPoints(),
points = previewPoints(base = 7500.0), // 步数,与 Mock 的 3000~12000 同量级
),
onBack = {},
onSelectRange = {},
@@ -4833,13 +4836,29 @@ cd /d/cherry/repos/ring-health-app && git add -A && git commit -m "docs: 补充
cd /d/cherry/docs && git add -A && git commit -m "docs: 补充 M1 实施计划" && git push
```
Expected: 三个仓库(app / api / docs)在 Gitea 上均为最新。
逐个确认三个仓库都没有未推送的提交(`ring-health-api` 在 Task 13 已推过,这里只做核对):
```bash
for r in ring-health-app ring-health-api docs; do
echo "--- $r"
git -C /d/cherry/repos/$r status -sb | head -1
git -C /d/cherry/repos/$r log --oneline origin/main..HEAD | sed 's/^/ 未推送: /'
done
```
Expected: 三行都是 `## main...origin/main`(不带 `[ahead N]`),且每条「未推送」下都没有输出。
若 app 或 docs 显示 `[ahead N]`,说明 push 没成功 —— 先查 credentials / 网络,**不要 `--force`**。
> `repos/docs` 不对 —— docs 仓库在 `/d/cherry/docs`(独立仓库 `ring-health-docs`),
> 上面循环里的 `docs` 路径要写成 `/d/cherry/docs`。三个仓库分别是:
> `/d/cherry/repos/ring-health-app`、`/d/cherry/repos/ring-health-api`、`/d/cherry/docs`。
---
## 备注
**图标依赖回退方案**:若 `material-icons-extended:1.7.8` 与 Compose BOM 2026.09.00 冲突导致构建失败,按此处理:
**图标依赖回退方案**:若 `material-icons-extended:1.7.8` 与 Compose BOM **2026.06.01**(对应 compose 1.11.4,
见 `gradle/libs.versions.toml:22`)冲突导致构建失败,按此处理:
1. 从 `libs.versions.toml` 移除 `androidx-icons-extended`,从 `app/build.gradle.kts` 移除对应依赖;
2. 新建 `core/designsystem/icon/RingIcons.kt`,用 `ImageVector.Builder` 手绘所需图标(步数/心率/睡眠/血氧/压力/体温/血压/蓝牙/戒指 共 9 个);