Custom exercises: muscles are stored in the map's order, not the order the chips were tapped in
This commit is contained in:
1 parent
0f7e3e1291
commit
83b2a140d6
3 files changed
+30
-3
No files matched your search
@@ -19,7 +19,7 @@ import { Button, Slider, Switch, Segmented, SelectRow, Row, TextField, NumberFie
|
||||
import { glyphOf, GLYPH_GROUPS, DEFAULT_GLYPH } from './lib/glyphs.js'
|
||||
import BodyMap from './components/BodyMap.jsx'
|
||||
import MuscleExplorer from './components/MuscleExplorer.jsx'
|
||||
import { exerciseMuscleSnapshot, loadOfWorkouts, MUSCLES, MUSCLE_NAME, normalizeMuscleGroups, hasExplicitMuscleMetadata } from './lib/muscles.js'
|
||||
import { exerciseMuscleSnapshot, loadOfWorkouts, MUSCLES, MUSCLE_NAME, normalizeMuscleGroups, hasExplicitMuscleMetadata, inMuscleOrder } from './lib/muscles.js'
|
||||
import { parseImport, mergeImport } from './lib/import-csv.js'
|
||||
import { importHevyData, HevyApiError, HEVY_DEV_SETTINGS, mergeHevyRoutines } from './lib/import-hevy.js'
|
||||
import { buildPlanBundle, parsePlan, mergePlan, printPlan, planPrintHTML } from './lib/plan-share.js'
|
||||
@@ -790,8 +790,10 @@ function CustomExForm({ existing, prefill, onDone, close }) {
|
||||
const dup = allExercises(S()).find(e => e.n.toLowerCase() === name.toLowerCase() && e.id !== (existing || {}).id)
|
||||
if (dup) { toast(t('“{0}” already exists', dup.n)); return }
|
||||
const d = desc.trim().slice(0, 1000)
|
||||
const prim = bp === 'cardio' ? ['cardiovascular system'] : [...primaries]
|
||||
const sm = secondaries.filter(m => !prim.includes(m))
|
||||
// Stored in the map's order, not the order the chips were tapped in — the tags on the exercise
|
||||
// used to shuffle with every edit.
|
||||
const prim = bp === 'cardio' ? ['cardiovascular system'] : inMuscleOrder(primaries)
|
||||
const sm = inMuscleOrder(secondaries.filter(m => !prim.includes(m)))
|
||||
const groups = [...prim, ...sm]
|
||||
let id = existing && existing.id
|
||||
if (existing) update(s => { const c = (s.customEx || []).find(x => x.id === id); if (c) {
|
||||
|
||||
Reference in new issue
Block a user