Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some comments to external APIs #2272

Merged
merged 4 commits into from
Mar 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/strange-yaks-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus-core": patch
"@khanacademy/perseus-score": patch
---

Add comments to external-facing functions
5 changes: 3 additions & 2 deletions packages/perseus-core/src/utils/split-perseus-item.ts
Original file line number Diff line number Diff line change
@@ -6,8 +6,9 @@ import {getUpgradedWidgetOptions} from "../widgets/upgrade";
import type {PerseusRenderer} from "../data-schema";

/**
* Upgrades widget options and removes answerful data for all the widgets in a
* Perseus item.
* Return a copy of a Perseus item with rubric data removed (ie answers)
*
* @param originalItem - the original, full Perseus item (which includes the rubric - aka answer data)
*/
export default function splitPerseusItem(
originalItem: PerseusRenderer,
8 changes: 7 additions & 1 deletion packages/perseus-score/src/score.ts
Original file line number Diff line number Diff line change
@@ -122,7 +122,13 @@ export function flattenScores(widgetScoreMap: {
return Object.values(widgetScoreMap).reduce(combineScores, noScore);
}

// once scorePerseusItem is the only one calling scoreWidgetsFunctional
/**
* score a Perseus item
*
* @param perseusRenderData - the full answer data, includes the correct answer
* @param userInputMap - the user's input for each widget, mapped by ID
* @param locale - string locale for math parsing ("de" 1.000,00 vs "en" 1,000.00)
*/
export function scorePerseusItem(
perseusRenderData: PerseusRenderer,
userInputMap: UserInputMap,