feat(worksheets): filter operator-specific scaffolds from preset summaries

When displaying difficulty preset descriptions in dropdown, filter out
scaffolds that don't apply to the current operator:

- Addition-only: hide borrowNotation, borrowingHints from summaries
- Subtraction-only: hide carryBoxes, tenFrames from summaries
- Mixed: show all scaffolds

Updated function:
- getScaffoldingSummary(): added operator parameter with conditional
  scaffold checking based on operator type

Fixes issue where preset dropdown showed subtraction-specific scaffolds
(borrow notation, borrowing hints) even for addition-only worksheets.

🤖 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-08 14:00:57 -06:00
parent cace1c75c6
commit 8407b070f9
1 changed files with 33 additions and 21 deletions

View File

@ -4,19 +4,34 @@ import { css } from '../../../../../../../styled-system/css'
/** /**
* Generate a human-readable summary of enabled scaffolding aids * Generate a human-readable summary of enabled scaffolding aids
* Returns JSX with each frequency group on its own line * Returns JSX with each frequency group on its own line
* @param displayRules - Display rules to summarize
* @param operator - Current worksheet operator (filters out irrelevant scaffolds)
*/ */
export function getScaffoldingSummary(displayRules: any): React.ReactNode { export function getScaffoldingSummary(
console.log('[getScaffoldingSummary] displayRules:', displayRules) displayRules: any,
operator?: 'addition' | 'subtraction' | 'mixed'
): React.ReactNode {
console.log('[getScaffoldingSummary] displayRules:', displayRules, 'operator:', operator)
const alwaysItems: string[] = [] const alwaysItems: string[] = []
const conditionalItems: string[] = [] const conditionalItems: string[] = []
// Addition-specific scaffolds (skip for subtraction-only)
if (operator !== 'subtraction') {
if (displayRules.carryBoxes === 'always') { if (displayRules.carryBoxes === 'always') {
alwaysItems.push('carry boxes') alwaysItems.push('carry boxes')
} else if (displayRules.carryBoxes !== 'never') { } else if (displayRules.carryBoxes !== 'never') {
conditionalItems.push('carry boxes') conditionalItems.push('carry boxes')
} }
if (displayRules.tenFrames === 'always') {
alwaysItems.push('ten-frames')
} else if (displayRules.tenFrames !== 'never') {
conditionalItems.push('ten-frames')
}
}
// Universal scaffolds (always show)
if (displayRules.answerBoxes === 'always') { if (displayRules.answerBoxes === 'always') {
alwaysItems.push('answer boxes') alwaysItems.push('answer boxes')
} else if (displayRules.answerBoxes !== 'never') { } else if (displayRules.answerBoxes !== 'never') {
@ -29,12 +44,8 @@ export function getScaffoldingSummary(displayRules: any): React.ReactNode {
conditionalItems.push('place value colors') conditionalItems.push('place value colors')
} }
if (displayRules.tenFrames === 'always') { // Subtraction-specific scaffolds (skip for addition-only)
alwaysItems.push('ten-frames') if (operator !== 'addition') {
} else if (displayRules.tenFrames !== 'never') {
conditionalItems.push('ten-frames')
}
if (displayRules.borrowNotation === 'always') { if (displayRules.borrowNotation === 'always') {
alwaysItems.push('borrow notation') alwaysItems.push('borrow notation')
} else if (displayRules.borrowNotation !== 'never') { } else if (displayRules.borrowNotation !== 'never') {
@ -46,6 +57,7 @@ export function getScaffoldingSummary(displayRules: any): React.ReactNode {
} else if (displayRules.borrowingHints !== 'never') { } else if (displayRules.borrowingHints !== 'never') {
conditionalItems.push('borrowing hints') conditionalItems.push('borrowing hints')
} }
}
if (alwaysItems.length === 0 && conditionalItems.length === 0) { if (alwaysItems.length === 0 && conditionalItems.length === 0) {
console.log('[getScaffoldingSummary] Final summary: no scaffolding') console.log('[getScaffoldingSummary] Final summary: no scaffolding')