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

Refine NumericInput's Rubric type #1761

Merged
merged 5 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions .changeset/wild-comics-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Refine NumericInput's Rubric type
9 changes: 7 additions & 2 deletions packages/perseus/src/validation.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type {
PerseusMatcherWidgetOptions,
PerseusMatrixWidgetOptions,
PerseusNumberLineWidgetOptions,
PerseusNumericInputWidgetOptions,
PerseusNumericInputAnswer,
PerseusOrdererWidgetOptions,
PerseusPlotterWidgetOptions,
PerseusRadioWidgetOptions,
Expand Down Expand Up @@ -137,7 +137,12 @@ export type PerseusNumberLineUserInput = {
divisionRange: ReadonlyArray<number>;
};

export type PerseusNumericInputRubric = PerseusNumericInputWidgetOptions;
export type PerseusNumericInputRubric = {
// A list of all the possible correct and incorrect answers
answers: ReadonlyArray<PerseusNumericInputAnswer>;
// A coefficient style number allows the student to use - for -1 and an empty string to mean 1.
coefficient: boolean;
};

export type PerseusNumericInputUserInput = {
currentValue: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
message: "",
},
],
labelText: "",
size: "normal",
static: false,
coefficient: true,
};

Expand All @@ -54,9 +51,6 @@
message: "",
},
],
labelText: "",
size: "normal",
static: false,
coefficient: true,
};

Expand Down Expand Up @@ -89,9 +83,6 @@
value: 45.289,
},
],
labelText: "",
size: "normal",
static: false,
coefficient: false,
};

Expand Down Expand Up @@ -127,9 +118,6 @@
answerForms: ["pi"],
},
],
labelText: "",
size: "normal",
static: false,
coefficient: false,
};

Expand All @@ -154,9 +142,6 @@
message: "",
},
],
labelText: "",
size: "normal",
static: false,
coefficient: true,
};

Expand All @@ -181,9 +166,6 @@
message: "",
},
],
labelText: "",
size: "normal",
static: false,
coefficient: true,
};

Expand All @@ -208,9 +190,6 @@
message: "",
},
],
labelText: "",
size: "normal",
static: false,
coefficient: true,
};

Expand Down Expand Up @@ -246,7 +225,7 @@
message: "",
},
],
labelText: "",

Check failure on line 228 in packages/perseus/src/widgets/numeric-input/numeric-input-validator.test.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x)

Object literal may only specify known properties, and 'labelText' does not exist in type 'PerseusNumericInputRubric'.
size: "normal",
static: false,
coefficient: true,
Expand Down Expand Up @@ -292,7 +271,7 @@
message: "",
},
],
labelText: "",

Check failure on line 274 in packages/perseus/src/widgets/numeric-input/numeric-input-validator.test.ts

View workflow job for this annotation

GitHub Actions / Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x)

Object literal may only specify known properties, and 'labelText' does not exist in type 'PerseusNumericInputRubric'.
size: "normal",
static: false,
coefficient: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ describe("static function getOneCorrectAnswerFromRubric", () => {
message: "",
},
],
labelText: "",
size: "normal",
static: false,
coefficient: true,
};
const singleAnswer =
Expand Down
Loading