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:
parent
cace1c75c6
commit
8407b070f9
|
|
@ -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[] = []
|
||||||
|
|
||||||
if (displayRules.carryBoxes === 'always') {
|
// Addition-specific scaffolds (skip for subtraction-only)
|
||||||
alwaysItems.push('carry boxes')
|
if (operator !== 'subtraction') {
|
||||||
} else if (displayRules.carryBoxes !== 'never') {
|
if (displayRules.carryBoxes === 'always') {
|
||||||
conditionalItems.push('carry boxes')
|
alwaysItems.push('carry boxes')
|
||||||
|
} else if (displayRules.carryBoxes !== 'never') {
|
||||||
|
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,22 +44,19 @@ 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') {
|
if (displayRules.borrowNotation === 'always') {
|
||||||
conditionalItems.push('ten-frames')
|
alwaysItems.push('borrow notation')
|
||||||
}
|
} else if (displayRules.borrowNotation !== 'never') {
|
||||||
|
conditionalItems.push('borrow notation')
|
||||||
|
}
|
||||||
|
|
||||||
if (displayRules.borrowNotation === 'always') {
|
if (displayRules.borrowingHints === 'always') {
|
||||||
alwaysItems.push('borrow notation')
|
alwaysItems.push('borrowing hints')
|
||||||
} else if (displayRules.borrowNotation !== 'never') {
|
} else if (displayRules.borrowingHints !== 'never') {
|
||||||
conditionalItems.push('borrow notation')
|
conditionalItems.push('borrowing hints')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayRules.borrowingHints === 'always') {
|
|
||||||
alwaysItems.push('borrowing hints')
|
|
||||||
} else if (displayRules.borrowingHints !== 'never') {
|
|
||||||
conditionalItems.push('borrowing hints')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alwaysItems.length === 0 && conditionalItems.length === 0) {
|
if (alwaysItems.length === 0 && conditionalItems.length === 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue