Skip to content

Commit

Permalink
Refine Sorter's Rubric type (#1765)
Browse files Browse the repository at this point in the history
## Summary:
As part of the Server Side Scoring project, this refactors Sorter's Rubric type to only contain data necessary for scoring. It also updates the tests to reflect this new type.

Issue: LEMS-2472

## Test plan:
- Confirm all checks pass
- Confirm Sorter widget still works as expected via Storybook

Author: Myranae

Reviewers: handeyeco, Myranae

Required Reviewers:

Approved By: handeyeco

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1765
  • Loading branch information
Myranae authored Oct 28, 2024
1 parent 9426509 commit 5cf8d97
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/hip-countries-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Refine Sorter's Rubric type
6 changes: 4 additions & 2 deletions packages/perseus/src/validation.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type {
PerseusOrdererWidgetOptions,
PerseusPlotterWidgetOptions,
PerseusRadioWidgetOptions,
PerseusSorterWidgetOptions,
PerseusTableWidgetOptions,
} from "./perseus-types";
import type {InteractiveMarkerType} from "./widgets/label-image/types";
Expand Down Expand Up @@ -171,7 +170,10 @@ export type PerseusRadioUserInput = {
noneOfTheAboveSelected?: boolean;
};

export type PerseusSorterRubric = PerseusSorterWidgetOptions;
export type PerseusSorterRubric = {
// Translatable Text; The correct answer (in the correct order). The user will see the cards in a randomized order.
correct: ReadonlyArray<string>;
};

export type PerseusSorterUserInput = {
options: ReadonlyArray<string>;
Expand Down
6 changes: 0 additions & 6 deletions packages/perseus/src/widgets/sorter/sorter-validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe("SorterValidator", () => {
changed: true,
};
const rubric: PerseusSorterRubric = {
padding: true,
layout: "horizontal",
correct: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"],
};
const result = sorterValidator(userInput, rubric);
Expand All @@ -26,8 +24,6 @@ describe("SorterValidator", () => {
changed: true,
};
const rubric: PerseusSorterRubric = {
padding: true,
layout: "horizontal",
correct: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"],
};
const result = sorterValidator(userInput, rubric);
Expand All @@ -40,8 +36,6 @@ describe("SorterValidator", () => {
changed: false,
};
const rubric: PerseusSorterRubric = {
padding: true,
layout: "horizontal",
correct: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"],
};
const result = sorterValidator(userInput, rubric);
Expand Down

0 comments on commit 5cf8d97

Please sign in to comment.