mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
refactor(workouts): rename write-time picker to dedupeWorkoutBatch
The v1.4.42 W5 helper shipped under the same identifier `pickCanonicalWorkoutRows` as the v1.4.30 read-time picker in `src/lib/measurements/`. Same name in two modules with different signatures (write-time takes no user-priority, read-time does) sets up the next contributor to auto-complete the name in a new route and silently invoke the wrong picker — no user-priority resolution on a read, missing the 90-second window on a write. Rename to `dedupeWorkoutBatch` so the write-time contract is self-describing. The read-time picker keeps its established name. One file's export + 12-case test suite + the batch-route caller update — no algorithm change.
This commit is contained in:
1 parent
958e2491e4
commit
a5176f4be9
3 files changed
+26
-22
No files matched your search
@@ -68,7 +68,7 @@ import {
|
||||
createBatchWorkoutSchema,
|
||||
MAX_WORKOUTS_PER_BATCH,
|
||||
} from "@/lib/validations/workout";
|
||||
import { pickCanonicalWorkoutRows } from "@/lib/workouts/canonical-rows";
|
||||
import { dedupeWorkoutBatch } from "@/lib/workouts/canonical-rows";
|
||||
import { Prisma, type MeasurementSource } from "@/generated/prisma/client";
|
||||
|
||||
// v1.4.25 W16c — push-suppression threshold for workout PRs. A batch
|
||||
@@ -270,7 +270,7 @@ async function postBatch(request: NextRequest): Promise<Response> {
|
||||
// dropped here surface to the iOS client as `duplicate` so the
|
||||
// sync cursor advances past them identically to the externalId
|
||||
// case below.
|
||||
const canonicalPrepared = pickCanonicalWorkoutRows(
|
||||
const canonicalPrepared = dedupeWorkoutBatch(
|
||||
prepared.map((p) => ({
|
||||
userId: p.row.userId,
|
||||
activityType: p.row.sportType,
|
||||
|
||||
Reference in new issue
Block a user