Skip to content

fix(programs): set suggested set programExerciseId to the real exercise id#229

Open
evan188199-tech wants to merge 1 commit into
Snouzy:mainfrom
evan188199-tech:fix/program-session-suggested-set-programExerciseId
Open

fix(programs): set suggested set programExerciseId to the real exercise id#229
evan188199-tech wants to merge 1 commit into
Snouzy:mainfrom
evan188199-tech:fix/program-session-suggested-set-programExerciseId

Conversation

@evan188199-tech

Copy link
Copy Markdown

What

In get-session-by-slug.action.ts, each suggested set's programExerciseId is filled with the session-exercise id instead of a program-exercise reference — a copy/paste assigning the same value to two fields.

suggestedSets: ex.suggestedSets.map((set) => ({
  id: set.id,
  programSessionExerciseId: set.programSessionExerciseId,
  programExerciseId: set.programSessionExerciseId,   // ← same as above

set.programSessionExerciseId is the parent ProgramSessionExercise.id (ex.id). The ProgramSuggestedSet model has no programExerciseId column, so the field is synthesized — and it's synthesized to the wrong value: it always mirrors programSessionExerciseId. The real program-exercise identity in this scope is ex.exerciseId (the underlying Exercise.id).

Impact

Latent: the current ProgramSessionClient doesn't read programExerciseId (it consumes types/valuesInt/valuesSec/units), so today's UI is unaffected. But SuggestedSet declares the field, so any future consumer or test gets a silently wrong value.

Fix

Carry the parent's real exercise id into the mapped set:

programExerciseId: ex.exerciseId,

Fixes #228.

…se id

get-session-by-slug mapped each suggested set's programExerciseId from
set.programSessionExerciseId, i.e. the parent ProgramSessionExercise id
(ex.id) — the same value it already assigned to programSessionExerciseId
one line above. ProgramSuggestedSet has no such column, so the field is
synthesized, and it was synthesized to the wrong value (always mirroring
the session-exercise id). Use ex.exerciseId (the underlying Exercise id)
instead.

Fixes Snouzy#228
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Workoutcool Team Team on Vercel.

A member of the Team first needs to authorize it.

@evan188199-tech

Copy link
Copy Markdown
Author

此 PR 由 GLM-5.2 修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: program session suggested set programExerciseId mirrors session-exercise id (copy/paste)

1 participant