fix(worksheets): sync preview and download problem generation

Fix parameter mismatch in generatePreview.ts that caused preview to
show different problems than downloaded PDF:

- Addition: fix parameter order (was digitRange first, should be pAnyStart)
- Addition: add missing interpolate parameter
- Subtraction: add missing interpolate parameter
- Mixed: add missing interpolate parameter

Now preview and download use identical parameters, generating the same
problem set for the same seed.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock
2025-12-05 10:03:40 -06:00
parent 739303ef5a
commit 822ef78e58

View File

@@ -10,8 +10,8 @@ import {
} from './problemGenerator'
import { getSkillById } from './skills'
import { generateTypstSource } from './typstGenerator'
import { validateWorksheetConfig } from './validation'
import { validateProblemSpace } from './utils/validateProblemSpace'
import { validateWorksheetConfig } from './validation'
export interface PreviewResult {
success: boolean
@@ -321,6 +321,7 @@ export function generateSinglePage(
validatedConfig.digitRange,
validatedConfig.pAnyStart,
validatedConfig.pAllStart,
validatedConfig.interpolate,
validatedConfig.seed
)
} else if (operator === 'subtraction') {
@@ -329,15 +330,18 @@ export function generateSinglePage(
validatedConfig.digitRange,
validatedConfig.pAnyStart,
validatedConfig.pAllStart,
validatedConfig.interpolate,
validatedConfig.seed
)
} else {
// Addition
problems = generateProblems(
validatedConfig.total,
validatedConfig.digitRange,
validatedConfig.pAnyStart,
validatedConfig.pAllStart,
validatedConfig.seed
validatedConfig.interpolate,
validatedConfig.seed,
validatedConfig.digitRange
)
}