Salud: reset one measurement, without losing the rest
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
"Podemos reiniciar los números de esas mediciones para yo enviar el de hoy." The whole-file reset
already existed two taps away in the setup sheet, but it is the wrong size for the question: the
four metrics he suspects are not the profile. Throwing away a month of heart rate to start steps
over is not a reset, it is a tax.
So a metric can now be forgotten on its own: the detail sheet has **Reset this measurement**, which
deletes that metric's days (and hours) and nothing else — the other metrics, the workouts and the
ingest key stay. With any Date Range wider than a day the phone re-sends that metric on its next
sync, which is what makes this a reset rather than a loss: Apple Health still has the data, and a
day total replaces the day it names, so the stored past is rewritten rather than duplicated.
The two destructive rows are worded apart on purpose and the confirm names the metric ("¿Reiniciar
Pasos?"), because the neighbouring action in the setup sheet takes every metric there is.
`dropMetric()` is pure and returns how many days it took, and the route answers `metric: null` for
a metric the profile does not have (or a profile with no health file at all) instead of an error —
a screen that says "nothing stored" is more useful than a 404 answering a button press. Tested
from both ends: the helper's purity and arithmetic, the route against a real server (one metric
gone, the others and the workouts intact, the key still working, and a re-sync rebuilding it), and
the sheet's flow through the real confirm. Mutation-checked: pointing the row at the whole-file
delete fails it.
This commit is contained in:
1 parent
d93861a73f
commit
5c69540f62
11 files changed
+209
-7
No files matched your search
+16
-2
@@ -668,10 +668,24 @@ paths:
|
||||
delete:
|
||||
tags: [health]
|
||||
operationId: vitalsClear
|
||||
summary: Delete the caller's health data
|
||||
description: >-
|
||||
summary: Delete the caller's health data, or one metric of it
|
||||
description: |
|
||||
Removes the profile's health file and nothing else: the workout history, the account and the
|
||||
ingest key are untouched, so a phone needs no re-configuring to sync again.
|
||||
|
||||
With `?metric=` it forgets **one** measurement instead, days and hours included, and leaves
|
||||
every other metric in place — the answer to "these numbers look wrong, start this one over".
|
||||
It is a reset rather than a loss whenever the automation's Date Range is wider than a day:
|
||||
the next sync sends that metric again from Apple Health. A metric the profile does not have
|
||||
answers `200` with `metric: null`, not an error.
|
||||
parameters:
|
||||
- name: metric
|
||||
in: query
|
||||
required: false
|
||||
schema: { type: string }
|
||||
description: >-
|
||||
The metric name exactly as HAE wrote it (`step_count`, `heart_rate`…). Omit it to clear
|
||||
everything.
|
||||
responses:
|
||||
'200':
|
||||
description: Deleted (also when there was nothing stored).
|
||||
|
||||
Reference in new issue
Block a user