fix: scaffolding changes now apply in mastery+mixed mode
**Bug:** In mastery+mixed mode (operator=addition+subtraction), changing scaffolding settings (e.g., answer boxes from "always" to "never") had no effect. The worksheet continued using the old settings. **Root Cause:** - Mastery+mixed mode uses operator-specific display rules: - `additionDisplayRules` for addition problems - `subtractionDisplayRules` for subtraction problems - ScaffoldingTab only updated the general `displayRules` field - Typst generator prioritizes operator-specific rules when they exist - User's changes were ignored **Fix:** - Detect mastery+mixed mode in ScaffoldingTab - Update ALL three display rule fields when in this mode: - `displayRules` (general) - `additionDisplayRules` (for + problems) - `subtractionDisplayRules` (for - problems) - Applies to both individual rule changes and preset buttons **Testing:** 1. Set mode=mastery, operator=mixed 2. Change any scaffolding setting (e.g., answer boxes → never) 3. Preview should immediately reflect the change 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
380ac6eb69
commit
510f052978
|
|
@ -15,13 +15,27 @@ export function ScaffoldingTab() {
|
||||||
|
|
||||||
const displayRules: DisplayRules = formState.displayRules ?? defaultAdditionConfig.displayRules
|
const displayRules: DisplayRules = formState.displayRules ?? defaultAdditionConfig.displayRules
|
||||||
|
|
||||||
|
// Check if we're in mastery+mixed mode (needs operator-specific rules)
|
||||||
|
const isMasteryMixed = formState.mode === 'mastery' && formState.operator === 'mixed'
|
||||||
|
|
||||||
const updateRule = (key: keyof DisplayRules, value: DisplayRules[keyof DisplayRules]) => {
|
const updateRule = (key: keyof DisplayRules, value: DisplayRules[keyof DisplayRules]) => {
|
||||||
onChange({
|
const newDisplayRules = {
|
||||||
displayRules: {
|
...displayRules,
|
||||||
...displayRules,
|
[key]: value,
|
||||||
[key]: value,
|
}
|
||||||
},
|
|
||||||
})
|
// In mastery+mixed mode, update both general AND operator-specific display rules
|
||||||
|
if (isMasteryMixed) {
|
||||||
|
onChange({
|
||||||
|
displayRules: newDisplayRules,
|
||||||
|
additionDisplayRules: newDisplayRules,
|
||||||
|
subtractionDisplayRules: newDisplayRules,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
onChange({
|
||||||
|
displayRules: newDisplayRules,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -47,19 +61,29 @@ export function ScaffoldingTab() {
|
||||||
</div>
|
</div>
|
||||||
<div className={css({ display: 'flex', gap: '1.5' })}>
|
<div className={css({ display: 'flex', gap: '1.5' })}>
|
||||||
<button
|
<button
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
onChange({
|
const newDisplayRules = {
|
||||||
displayRules: {
|
...displayRules,
|
||||||
...displayRules,
|
carryBoxes: 'always' as const,
|
||||||
carryBoxes: 'always',
|
answerBoxes: 'always' as const,
|
||||||
answerBoxes: 'always',
|
placeValueColors: 'always' as const,
|
||||||
placeValueColors: 'always',
|
tenFrames: 'always' as const,
|
||||||
tenFrames: 'always',
|
borrowNotation: 'always' as const,
|
||||||
borrowNotation: 'always',
|
borrowingHints: 'always' as const,
|
||||||
borrowingHints: 'always',
|
}
|
||||||
},
|
// In mastery+mixed mode, update operator-specific rules too
|
||||||
})
|
if (isMasteryMixed) {
|
||||||
}
|
onChange({
|
||||||
|
displayRules: newDisplayRules,
|
||||||
|
additionDisplayRules: newDisplayRules,
|
||||||
|
subtractionDisplayRules: newDisplayRules,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
onChange({
|
||||||
|
displayRules: newDisplayRules,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}}
|
||||||
className={css({
|
className={css({
|
||||||
px: '2',
|
px: '2',
|
||||||
py: '0.5',
|
py: '0.5',
|
||||||
|
|
@ -76,19 +100,29 @@ export function ScaffoldingTab() {
|
||||||
All Always
|
All Always
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
onChange({
|
const newDisplayRules = {
|
||||||
displayRules: {
|
...displayRules,
|
||||||
...displayRules,
|
carryBoxes: 'never' as const,
|
||||||
carryBoxes: 'never',
|
answerBoxes: 'never' as const,
|
||||||
answerBoxes: 'never',
|
placeValueColors: 'never' as const,
|
||||||
placeValueColors: 'never',
|
tenFrames: 'never' as const,
|
||||||
tenFrames: 'never',
|
borrowNotation: 'never' as const,
|
||||||
borrowNotation: 'never',
|
borrowingHints: 'never' as const,
|
||||||
borrowingHints: 'never',
|
}
|
||||||
},
|
// In mastery+mixed mode, update operator-specific rules too
|
||||||
})
|
if (isMasteryMixed) {
|
||||||
}
|
onChange({
|
||||||
|
displayRules: newDisplayRules,
|
||||||
|
additionDisplayRules: newDisplayRules,
|
||||||
|
subtractionDisplayRules: newDisplayRules,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
onChange({
|
||||||
|
displayRules: newDisplayRules,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}}
|
||||||
className={css({
|
className={css({
|
||||||
px: '2',
|
px: '2',
|
||||||
py: '0.5',
|
py: '0.5',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue