-
Notifications
You must be signed in to change notification settings - Fork 548
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
Fix #3946: Fix solution automatically revealing after first hint reveal #3955
Conversation
@rt4914 PTAL (for codeowners + other changes if you can since the PR isn't affecting too many files). |
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, thanks.
Hi @BenHenning, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
Thanks @rt4914! |
SIGSEGV in StateFragmentTest for the Gradle run. Re-running since that test should pass in this PR. |
Looks like everything is passing, so merging now. |
#3975) * Fix #3946: Fix solution automatically revealing after first hint reveal (#3955) * Fix solution auto showing after hint reveal. See #3946 & PR for specifics. * Add translations for new hint/solution. * Lint fixes. * Add TODO. * Fix Gradle-variant tests. * Fix #3937: Ensure ViewEventLogsViewModel builds for alpha builds (#3957) * Ensure ViewEventLogsViewModel builds for alpha. * BUILD file lint fix. * Fix #3939 & #3938: Fix KitKat crash & SVG rendering issues (#3963) * Fix KitKat crash when opening Help menu. * Fix SVG rendering on SDKs 19-23 (incl). * Add regex check to prohibit Delegates. * Lint fixes. * Add exemption for regex script test. * Update file_content_validation_checks.textproto Grammar fix in error. * Update RegexPatternValidationCheckTest.kt Copy grammar fix to test copy of error. * Update version.bzl (#3964) Bump version codes for another RC of release-0.6. * Embed proguard.map in optimized AAB builds. (#3973)
This is confirmed as fixed in the release branch. |
Explanation
Fix #3946
Per #3946 there's a bug in some contexts where, after revealing a hint, the solution may automatically be revealed as well when the user reopens the solution dialog.
The root cause of this is that the hint handler decides whether to show solutions based on the presence of a correct answer, not based on the presence of a solution itself. This presents a problem specifically for proto-based lessons because in some cases correct_answer will be absent (if the converter can't properly convert the answer into an app-acceptable format, e.g. text or fraction). This is technically a valid case to introduce a failure, but due to #1050 we can't actually assume that correct_answer is properly defined. Thus, the solution is to change the check to instead check for whether solution is present. This does allow for an empty solution object to be added to the proto, but this shouldn't realistically happen in practice so it should be fine.
To repro (on this branch):
Note that this doesn't affect json since we've taken some measure to ensure that correct_answer is filled with something even if that value isn't quite correct.
To ensure this regression is properly caught, tests were added both in StateFragmentLocalTest and HintHandlerProdImplTest. Note that the latter required introducing a new test exploration that specifically tests a missing correct_answer, and the former required changes to the prototype exploration to introduce a hint & solution in the numeric expression state to more easily repro this issue. Test results:
Other miscellaneous changes:
Essential Checklist
For UI-specific PRs only
N/A -- this is fixing a UI-affecting issue, but doesn't actually change the UI.