fix: update operator-specific display rules in mastery+mixed mode

When in mastery mode with mixed operator, the system uses separate
display rules for addition and subtraction (additionDisplayRules and
subtractionDisplayRules). The Layout tab was only updating the general
displayRules, which meant problemNumbers and cellBorders toggles had
no effect on the actual worksheet.

Now when toggling these settings, we update:
- displayRules (general)
- additionDisplayRules (if in mastery+mixed mode)
- subtractionDisplayRules (if in mastery+mixed mode)

This ensures the settings are respected across all problem types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-11-18 11:18:30 -06:00
parent 3e843e0051
commit 4174b6d2e7
1 changed files with 52 additions and 4 deletions

View File

@ -88,14 +88,38 @@ export function LayoutTab() {
console.log('[LayoutTab] Changing problemNumbers:', {
from: displayRules.problemNumbers,
to: value,
mode: formState.mode,
operator: formState.operator,
fullDisplayRules: displayRules,
})
onChange({
// Update general displayRules
const updates: any = {
displayRules: {
...displayRules,
problemNumbers: value,
},
})
}
// CRITICAL: In mastery+mixed mode, also update operator-specific display rules
if (formState.mode === 'mastery' && formState.operator === 'mixed') {
// Update additionDisplayRules if they exist
if (formState.additionDisplayRules) {
updates.additionDisplayRules = {
...formState.additionDisplayRules,
problemNumbers: value,
}
}
// Update subtractionDisplayRules if they exist
if (formState.subtractionDisplayRules) {
updates.subtractionDisplayRules = {
...formState.subtractionDisplayRules,
problemNumbers: value,
}
}
}
onChange(updates)
}}
onCellBordersChange={(value) => {
const displayRules: DisplayRules =
@ -103,14 +127,38 @@ export function LayoutTab() {
console.log('[LayoutTab] Changing cellBorders:', {
from: displayRules.cellBorders,
to: value,
mode: formState.mode,
operator: formState.operator,
fullDisplayRules: displayRules,
})
onChange({
// Update general displayRules
const updates: any = {
displayRules: {
...displayRules,
cellBorders: value,
},
})
}
// CRITICAL: In mastery+mixed mode, also update operator-specific display rules
if (formState.mode === 'mastery' && formState.operator === 'mixed') {
// Update additionDisplayRules if they exist
if (formState.additionDisplayRules) {
updates.additionDisplayRules = {
...formState.additionDisplayRules,
cellBorders: value,
}
}
// Update subtractionDisplayRules if they exist
if (formState.subtractionDisplayRules) {
updates.subtractionDisplayRules = {
...formState.subtractionDisplayRules,
cellBorders: value,
}
}
}
onChange(updates)
}}
/>
)