-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Migrates text input rules from NormalizedString to SetOfNormalizedString #10882
Conversation
Assigning @DubeySandeep for the first-pass review of this pull request. Thanks! |
Hi @shavavo! FYI -- frontend tests are failing? (Not sure how that happened -- aren't they checked pre-push?) |
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.
Thanks, @shavavo! Took a pass.
editDistance[i][j] = Math.min( | ||
editDistance[i - 1][j - 1], editDistance[i][j - 1], | ||
editDistance[i - 1][j]) + 1; | ||
const levenshtein = (inputString, matchString) => { |
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.
Start with a verb, and also be clearer that this is returning a boolean rather than the distance: hasEditDistanceEqualToOne or isDifferentByOneCharacter or hasExactlyOneTypo or similar.
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.
Done
warningsList.push({ | ||
type: AppConstants.WARNING_TYPES.ERROR, | ||
message: ( | ||
`Answer group ${answerGroupIndex + 1} has multiple rules on ` + |
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.
on --> with
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.
Done
if (rule.type === 'Contains') { | ||
// Check if the current string contains any of the previously seen | ||
// strings as a substring. | ||
if (seenStringsContains.some( | ||
(seenString) => currentString.includes(seenString)) || | ||
(seenString) => currentStrings.includes(seenString)) || |
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.
This seems wrong? Previously, the variable was a string, now it's an array. I think you're checking for something different here?
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.
Done
} else if (rule.type === 'StartsWith') { | ||
// Check if the current string contains any of the previously seen | ||
// strings as a prefix. | ||
if (seenStringsStartsWith.concat(seenStringsContains).some( | ||
(seenString) => currentString.indexOf(seenString) === 0)) { | ||
(seenString) => currentStrings.indexOf(seenString) === 0)) { |
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.
Ditto.
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.
Done
warningsList.push({ | ||
type: AppConstants.WARNING_TYPES.ERROR, | ||
message: `Rule ${ruleIndex + 1} from answer group ` + | ||
`${answerGroupIndex + 1} will never be matched because it ` + | ||
'is preceded by a \'FuzzyEquals\' rule with a matching input.' | ||
}); | ||
} | ||
seenStringsFuzzyEquals.push(currentString); | ||
seenStringsFuzzyEquals.push(...currentStrings); |
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.
Don't you need to update the tests...?
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.
Done
"Contains": "contains {{x|NormalizedString}}", | ||
"Equals": "is equal to {{x|NormalizedString}}, without taking case into account", | ||
"FuzzyEquals": "is equal to {{x|NormalizedString}}, misspelled by at most one character" | ||
"StartsWith": "starts with one of {{x|SetOfNormalizedString}}", |
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.
Maybe change to "at least one of", ditto below where appropriate
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.
Done
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.
LGTM for the codeowner files: core/domain/draft_upgrade_services*.py
Unassigning @DubeySandeep since they have already approved the PR. |
Assigning @vojtechjelinek, @nithusha21, @aks681 for code owner reviews. Thanks! |
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, confirming this looks good from a test-run perspective! Therefore giving LGTM, but @shavavo please note #10882 (review).
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.
Lgtm as codeowner
Assigning @BenHenning for code owner reviews. Thanks! |
Hi @shavavo -- could you please try running the Thanks! |
Hmm I think oppiabot mistook me for a code owner for some reason. @jameesjohn do you have any idea why that might be? I was a code owner at the beginning of this PR, but have since changed. I'll cancel my review to avoid confusing it further. @shavavo feel free to re-assign me if you'd like me to do another review pass. |
Removing "LGTM" label since 1 more approval is required for this PR. Thanks! |
@srijanreddy98 PTAL! |
…ing (oppia#10882) * review comment from PR10246 * migration and frontend changes * linter * backend test fixes * frontend tests * styling * coverage * review & fixed e2e tests * fit * review * tests * todo comment * fix comment * e2e tests * fix e2e tests * fix e2e tests Co-authored-by: shavavo <[email protected]>
Overview
This PR does the following:
These changes are required to make rule inputs translatable.