-
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
Move scoring out of general Util into scoring util file #1962
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
@@ -1,21 +1,4 @@ | |||
import Util, {isCorrect} from "../util"; | |||
|
|||
describe("isCorrect", () => { |
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.
All deleted tests here just moved to scoring.test.ts
@@ -47,7 +47,7 @@ import {DependenciesContext} from "../dependencies"; | |||
import HintsRenderer from "../hints-renderer"; | |||
import {Log} from "../logging/log"; | |||
import Renderer from "../renderer"; | |||
import Util from "../util"; | |||
import {combineScores, keScoreFromPerseusScore} from "../util/scoring"; |
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.
Also switched to ES6 exports in the new file.
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (f44e07e) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1962 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1962 |
Size Change: +6 B (0%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
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 have to remove that unused import for the failing check :)
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 think you'll need to make changes to index.ts
to make sure the utils that are used in Webapp are still accessible. Otherwise a great change. 👍
.changeset/clever-cars-eat.md
Outdated
@@ -0,0 +1,5 @@ | |||
--- | |||
"@khanacademy/perseus": minor |
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'd argue this is a major change. Util
is exported from index.ts
:
export {default as Util} from "./util";
You'll see that this breaks Webapp because I used Util.keScoreFromPerseusScore
in my recent change. So:
- Probably a major change
- I'd double check the utils that you moved to make sure they're not used in Webapp (and export the ones that are)
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.
Agreed. I didn't catch the one usage of keScoreFromPerseusScore
outside of Perseus. Fixing.
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/perseus@46.0.0 ### Major Changes - [#1962](#1962) [`435280ac4`](435280a) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Move scoring utility functions out of `Util` object into their own file and only export externally used function (`keScoreFromPerseusScore`) - [#1961](#1961) [`d93e3ecde`](d93e3ec) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Remove deprecated/unused `examples()` function from `Renderer` ## @khanacademy/perseus-editor@15.1.3 ### Patch Changes - Updated dependencies \[[`435280ac4`](435280a), [`d93e3ecde`](d93e3ec)]: - @khanacademy/perseus@46.0.0 Author: khan-actions-bot Reviewers: jeremywiebe Required Reviewers: Approved By: jeremywiebe Checks: ⏭️ Publish npm snapshot, ✅ Cypress (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald Pull Request URL: #1964
Summary:
Like #1948, I was working in
utils.ts
and found it annoying how there were so many different utils in one file (graphing support, scoring, word/text manipulation). So this just pulls scoring-related behaviour out into a new file. This means these symbols are no longer on theUtils
object, but I checked and they aren't used in Perseus nor in consuming apps.Issue: LEMS-2561
Test plan:
yarn test
yarn typecheck