feat: enrich common row muscle metadata

This commit is contained in:
Space_Hermes committed 2026-08-06 19:46:18 +02:00
1 parent 551b072c54
commit 941d911fa9
2 files changed
+49 -1

No files matched your search

+16 -1
View File
@@ -2,8 +2,23 @@ import { EXDB } from './exercises-data.js'
import { t } from './i18n-core.js'
export { EXDB }
// The generated dataset already supplies secondary muscles for most exercises. Keep the
// handful of conservative catalogue additions that are useful to the muscle map here so a
// dataset refresh does not erase them. Values follow the dataset's existing alias vocabulary.
const SECONDARY_ADDITIONS = {
'0027': ['rear deltoids'], // barbell bent over row
'0293': ['rear deltoids'], // dumbbell bent over row
'0499': ['rear deltoids'], // inverted row
'0861': ['rear deltoids'], // cable seated row
}
export const EXIDX = {}
EXDB.forEach(e => { EXIDX[e.id] = e })
EXDB.forEach(e => {
const additions = SECONDARY_ADDITIONS[e.id]
if (additions) e.sm = [...new Set([...(e.sm || []), ...additions])]
EXIDX[e.id] = e
})
export const BODYPARTS = [...new Set(EXDB.map(e => e.bp))].sort()
// Equipment options present in a given list of exercises, most common first (issue #6).
+33
View File
@@ -0,0 +1,33 @@
import { describe, expect, it } from 'vitest'
import { EXIDX } from './exercises.js'
import { musclesOf } from './muscles.js'
// The catalogue keeps the source dataset's secondary-muscle spellings; musclesOf maps
// those aliases to the canonical body-map slugs and applies the 0.4 support weight.
describe('catalogue secondary muscles', () => {
it('maps a bench press to chest, triceps and deltoids', () => {
expect(musclesOf(EXIDX['0025'])).toMatchObject({
chest: 1,
triceps: 0.4,
deltoids: 0.4,
})
})
it('maps a squat to glutes, quads and hamstrings', () => {
expect(musclesOf(EXIDX['0043'])).toMatchObject({
gluteal: 1,
quadriceps: 0.4,
hamstring: 0.4,
})
})
it('maps common row variations to the upper back, biceps and rear deltoids', () => {
for (const id of ['0027', '0293', '0499', '0861']) {
expect(musclesOf(EXIDX[id])).toMatchObject({
'upper-back': 1,
biceps: 0.4,
deltoids: 0.4,
})
}
})
})