-
Notifications
You must be signed in to change notification settings - Fork 350
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
Matrix: Extract validation from scorer #1883
Conversation
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (6109412) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1883 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1883 |
Size Change: +175 B (+0.01%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just left some questions to consider :)
* | ||
* @see `scoreMatrix()` for more details. | ||
*/ | ||
function validateMatrix( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Did you decide just to leave all the createValidator
logic in the scoring function? Do you think this is something we might want to change in the future? Looks like some of it is for scoring, but some is for validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's all left in the scoring function because there is no logic that can be moved into the validator that doesn't require the scoring data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It kind of looked like the hasEmptyCell
check could possibly be moved out, but then you'd duplicate a lot of that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. I need the solution size for part of these check but the hasEmptyCell
check can definitely be raised up!
I'm confused between this and #1881 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this PR better than #1881 😅
}; | ||
} & PerseusMatrixValidationData; | ||
|
||
export type PerseusMatrixValidationData = Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned this in the other PRs, but just to be extra annoying: I'm not sure we really need a bunch of aliases for Empty
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it (and others that were Empty
). I've added a doc comment to the top of this file in another PR.
dea057c
to
718fc62
Compare
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Major Changes - [#1905](#1905) [`9c225f936`](9c225f9) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - We're reverting work done for the Server Side Scoring and Input Number Conversion projects. ### Minor Changes - [#1883](#1883) [`adad642ab`](adad642) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Introduces a validation function for the matrix widget (extracted from matrix scoring function). - [#1878](#1878) [`a27f23bb4`](a27f23b) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Add expression validator function ### Patch Changes - [#1890](#1890) [`0afb1a4f7`](0afb1a4) Thanks [@nishasy](https://github.com/nishasy)! - [Locked Labels + Aria] Create math only parser to help parse TeX how we want - [#1889](#1889) [`55a532175`](55a5321) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters - [#1852](#1852) [`4b8836b84`](4b8836b) Thanks [@catandthemachines](https://github.com/catandthemachines)! - Adding open and closing behavior to unlimited polygon graph type. - Updated dependencies \[[`55a532175`](55a5321)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Major Changes - [#1905](#1905) [`9c225f936`](9c225f9) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - We're reverting work done for the Server Side Scoring and Input Number Conversion projects. ### Patch Changes - [#1889](#1889) [`55a532175`](55a5321) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters - Updated dependencies \[[`adad642ab`](adad642), [`0afb1a4f7`](0afb1a4), [`55a532175`](55a5321), [`9c225f936`](9c225f9), [`4b8836b84`](4b8836b), [`a27f23bb4`](a27f23b)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1889](#1889) [`55a532175`](55a5321) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters ## @khanacademy/[email protected] ### Patch Changes - [#1889](#1889) [`55a532175`](55a5321) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`55a532175`](55a5321)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1889](#1889) [`55a532175`](55a5321) Thanks [@benchristel](https://github.com/benchristel)! - Internal: enable strict typechecking of function parameters ## @khanacademy/[email protected] ### Major Changes - [#1905](#1905) [`9c225f936`](9c225f9) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - We're reverting work done for the Server Side Scoring and Input Number Conversion projects. ### Patch Changes - Updated dependencies \[[`55a532175`](55a5321)]: - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected] - @khanacademy/[email protected]
## Summary: This PR extracts validation from the `matrix`'s scorer function. In reality, it's an empty function, but it follows our conventions for having the scorer call a validator first. I've created the standard tests to ensure that scorer calls the validator. Issue: LEMS-2602 ## Test plan: `yarn test` `yarn typecheck` Author: jeremywiebe Reviewers: Myranae, handeyeco, jeremywiebe Required Reviewers: Approved By: Myranae, handeyeco Checks: ✅ Publish npm snapshot (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), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1883
Summary:
This PR extracts validation from the
matrix
's scorer function. In reality, it's an empty function, but it follows our conventions for having the scorer call a validator first. I've created the standard tests to ensure that scorer calls the validator.Issue: LEMS-2602
Test plan:
yarn test
yarn typecheck