Custom exercises: un-ticking the target hands it to a muscle you tapped, not to the topmost one (QA C10 follow-up)
cc116bd gave a custom exercise the primary tapped first as its target and let an edit keep that
target while the muscle is still a primary. Un-tick it, though, and the fallback was the first
entry of the form's primaries — and for an existing exercise that list is seeded from the store,
which holds the muscles in the map's head-to-toe order. So editing "QA Hip Thrust Pull" (upper
legs, primaries Traps/Glutes/Hamstrings, target Hamstrings), dropping Hamstrings and tapping
Quads, put the target on Traps and the library, picker and Muscles rows read "Traps · barbell"
again: exactly the symptom C10 was about.
The form now remembers which primary chips were tapped in this sheet, in that order. That is the
only record of the user's own order, since the stored list has none, and a dropped target goes to
the first of those taps that is still a primary. A tap that only turned a chip off is skipped with
it, and the sorted list stays as the last resort for the user who drops the target and adds
nothing in its place. Stored primaries and secondaries keep the map's order.
Rig check (slot 33, 412 px, seeded exercise, un-tick Hamstrings + tap Quads): tg "quadriceps",
primaries ['trapezius','gluteal','quadriceps'], library row "Quads · Barbell" - the same script on
the branch build reports tg "trapezius" and "Traps · barbell". The C9/C10 sweep (create tapping
Hamstrings, Glutes, Traps; untouched re-save; library, picker, config, Muscles and workout rows in
English and German) prints byte-identical output on both builds: tg "hamstring" before and after
the re-save, no raw muscle ids, cardio reads "Herz-Kreislauf".
This commit is contained in:
1 parent
0fa35030ee
commit
668002b066
2 files changed
+42
-2
No files matched your search
@@ -110,4 +110,33 @@ describe('custom exercise target (QA C10)', () => {
|
||||
expect(c.primaries).toEqual(['gluteal'])
|
||||
expect(c.tg).toBe('gluteal')
|
||||
})
|
||||
|
||||
// Dropping the target used to hand it to the head of the map-sorted list, which is where C10
|
||||
// started: an upper-legs exercise read "Traps · barbell" again the moment its target went away.
|
||||
it('hands a dropped target to the primary tapped in this sheet, not to the topmost muscle', () => {
|
||||
const ex = custom({ tg: 'hamstring', primaries: ['trapezius', 'gluteal', 'hamstring'], secondaries: ['forearm'], sm: ['forearm'],
|
||||
muscleGroups: ['trapezius', 'gluteal', 'hamstring', 'forearm'] })
|
||||
seed(ex)
|
||||
customExSheet(EXIDX[ex.id])
|
||||
const form = renderTop()
|
||||
pickMuscles(form, 'Primary muscle groups', ['Hamstrings', 'Quads']) // untick the target, tap another
|
||||
click(form, 'button', 'Save')
|
||||
const c = S().customEx[0]
|
||||
expect(c.primaries).toEqual(['trapezius', 'gluteal', 'quadriceps'])
|
||||
expect(c.tg).toBe('quadriceps')
|
||||
})
|
||||
|
||||
// Tapping the same chip twice leaves the selection as it was, so it says nothing about what the
|
||||
// user wants the target to be — the muscle actually added does.
|
||||
it('ignores a primary that was tapped on and off again', () => {
|
||||
const ex = custom({ tg: 'hamstring', primaries: ['trapezius', 'hamstring'], secondaries: [], sm: [], muscleGroups: ['trapezius', 'hamstring'] })
|
||||
seed(ex)
|
||||
customExSheet(EXIDX[ex.id])
|
||||
const form = renderTop()
|
||||
pickMuscles(form, 'Primary muscle groups', ['Hamstrings', 'Chest', 'Chest', 'Glutes'])
|
||||
click(form, 'button', 'Save')
|
||||
const c = S().customEx[0]
|
||||
expect(c.primaries).toEqual(['trapezius', 'gluteal'])
|
||||
expect(c.tg).toBe('gluteal')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user