@khanacademy/perseus-score 8.9.2 → 8.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.js +2 -2
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/score.d.ts +29 -2
- package/package.json +3 -3
package/dist/score.d.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import type { PerseusRenderer, PerseusScore, PerseusWidgetsMap, UserInputMap } from "@khanacademy/perseus-core";
|
|
2
|
+
type WidgetScores = {
|
|
3
|
+
[widgetId: string]: PerseusScore;
|
|
4
|
+
};
|
|
5
|
+
type PerseusScoreWithWidgetScores = PerseusScore & {
|
|
6
|
+
/**
|
|
7
|
+
* The per-widget scores, keyed by widget ID, that contributed to the
|
|
8
|
+
* item's overall score (see the `earned` and `total` fields).
|
|
9
|
+
*/
|
|
10
|
+
widgetScores: WidgetScores;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Filters the given widget `scores` dictionary and returns only widget scores
|
|
14
|
+
* that are invalid.
|
|
15
|
+
*/
|
|
16
|
+
export declare function onlyInvalidScores(scores: WidgetScores): WidgetScores;
|
|
17
|
+
/**
|
|
18
|
+
* Combines an overall score with constituent widget scores. Takes into account
|
|
19
|
+
* if the overall score is invalid and strips out any widget scores that are
|
|
20
|
+
* not `invalid` to protect against leaking correctness.
|
|
21
|
+
*/
|
|
22
|
+
export declare function combineScoreWithWidgetScores(score: PerseusScore, widgetScores: WidgetScores): PerseusScoreWithWidgetScores;
|
|
2
23
|
/**
|
|
3
24
|
* score a Perseus item
|
|
4
25
|
*
|
|
@@ -8,13 +29,19 @@ import type { PerseusRenderer, PerseusScore, PerseusWidgetsMap, UserInputMap } f
|
|
|
8
29
|
* @param perseusRenderData - the full answer data, includes the correct answer
|
|
9
30
|
* @param userInputMap - the user's input for each widget, mapped by ID
|
|
10
31
|
* @param locale - string locale for math parsing ("de" 1.000,00 vs "en" 1,000.00)
|
|
32
|
+
*
|
|
33
|
+
* @returns The full {@link PerseusScore} as well as widget-level scores which
|
|
34
|
+
* can be used to analyze which parts of the question the learner got correct
|
|
35
|
+
* vs. incorrect. When the score result is "invalid", only "invalid" widget
|
|
36
|
+
* scores are included in `widgetScores`.
|
|
11
37
|
*/
|
|
12
|
-
export declare function scorePerseusItem(perseusRenderData: PerseusRenderer, userInputMap: UserInputMap, locale: string):
|
|
38
|
+
export declare function scorePerseusItem(perseusRenderData: PerseusRenderer, userInputMap: UserInputMap, locale: string): PerseusScoreWithWidgetScores;
|
|
13
39
|
/**
|
|
14
40
|
* @experimental - this is a temporary function for use by the Input Number to
|
|
15
41
|
* Numeric Input project. It will be removed in a future minor version.
|
|
16
42
|
*/
|
|
17
|
-
export declare function scorePerseusItemWithInputNumberAsNumericInput(perseusRenderData: PerseusRenderer, userInputMap: UserInputMap, locale: string):
|
|
43
|
+
export declare function scorePerseusItemWithInputNumberAsNumericInput(perseusRenderData: PerseusRenderer, userInputMap: UserInputMap, locale: string): PerseusScoreWithWidgetScores;
|
|
18
44
|
export declare function scoreWidgetsFunctional(widgets: PerseusWidgetsMap, widgetIds: ReadonlyArray<string>, userInputMap: UserInputMap, locale: string): {
|
|
19
45
|
[widgetId: string]: PerseusScore;
|
|
20
46
|
};
|
|
47
|
+
export {};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Perseus score",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "8.
|
|
6
|
+
"version": "8.10.1",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@khanacademy/kas": "2.2.3",
|
|
26
|
-
"@khanacademy/kmath": "2.4.
|
|
27
|
-
"@khanacademy/perseus-core": "26.
|
|
26
|
+
"@khanacademy/kmath": "2.4.11",
|
|
27
|
+
"@khanacademy/perseus-core": "26.3.1",
|
|
28
28
|
"@khanacademy/perseus-utils": "2.1.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|