-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[BUG]: Unexpected error on Exploration Editor page RTE component modal when start time is greater than end time #18211
Comments
Hello, I have implemented a validation of the fields in rte-helper-modal.controller.ts and the message to be raised in rte-helper-modal.component.html so that users are not able to press Done if the start time is greater than the end time. Here is a video of how it looks with my implementation. Can I please get this issue assigned to me? oppia_issue_film.mov |
Hi @shricodev @kshitij01042002 do you think this solution looks good? |
Hi @yungmulah thanks for the solution. The solution looks good to me. @shricodev please let us know if it satisfies your expectations. |
@kshitij01042002 The change seems correct to me as well. |
@shricodev I made it so that start time < end time or else the error will trigger since it does not make sense to me to have it set to the same, please correct me if I am wrong here. I can add an additional prompt if they are equal if that is better. |
@yungmulah Yup, it sounds good. Feel free to open a PR. I think we also need to make sure that if start_time and end_time are the same, the user is not able to save it. If any change is required, then we will discuss it in the PR thread. @kshitij01042002 @seanlip what do you say? |
Thanks @shricodev, opened a PR. |
Thanks @shricodev @yungmulah. Re the question about equality, could you please link to the line of code that produced the Thanks! |
I tried looking into where the error was produced but could not find it. My solution validates on the front end so that the error does not trigger. Maybe @shricodev knows where it is raised? |
@seanlip @shricodev Is the solution proposed in the PR sufficient for now since it fulfills all the requirements in the Exprected Behaviour of this issue? |
@yungmulah I think you need to address the comment I posted previously. Where is the current message coming from? We do need to ensure consistency. Have you tried searching the codebase for (parts of) the currently-displayed error message? |
@seanlip I see, looked some more and found the autosave-info-modals to contain
and also the save-validation-fail-modal.component.html to be raised. Maybe this can help guiding to exactly where the validation is made? |
@yungmulah That doesn't really look related to the Here's what you can do. Try reproducing the original issue. When the error happens, look at (a) the console logs, and (b) the server logs in the terminal. Try pasting them in this thread. Then let's see if there are any clues there? |
So after reproducing the error I get the following error logs in the console Inspecting the NonStrictValidationError from the console I can see that autosaveChangeListOnChange in change-list.service.ts raises it autosaveChangeListOnChange(explorationChangeList) {
// Asynchronously send an autosave request, and check for errors in the
// response:
// If an error is present -> Check for the type of error that occurred
// (Display the corresponding modals in both cases, if not already
// opened):
// - Changes are not mergeable when a version mismatch occurs.
// - Non-strict Validation Fail.
this.explorationDataService.autosaveChangeListAsync(explorationChangeList, response => {
if (!response.changes_are_mergeable) {
if (!this.autosaveInfoModalsService.isModalOpen()) {
this.autosaveInfoModalsService.showVersionMismatchModal(explorationChangeList);
}
}
this.autosaveInProgressEventEmitter.emit(false);
if (!response.is_version_of_draft_valid && response.changes_are_mergeable) {
this.windowRef.nativeWindow.location.reload();
}
}, () => {
this.alertsService.clearWarnings();
this.loggerService.error('nonStrictValidationFailure: ' + JSON.stringify(explorationChangeList));
if (!this.autosaveInfoModalsService.isModalOpen()) {
this.autosaveInfoModalsService.showNonStrictValidationFailModal();
}
this.autosaveInProgressEventEmitter.emit(false);
});
} which I think is using the exploration-data.service.ts to send data to the exploration editor backend. Unfortunately I canLooking inside the ExplorationDataService I can not seem to find any validation, so maybe this is performed in the backend? Sorry if I am looking in the wrong files, first time doing this @seanlip. |
The |
Thanks for the tip @seanlip, after more investigation this is the error printed in the console from the backend
which takes me to html_cleaner.py in the backend that does the following validation on line 401-406 start_value = float(tag['start-with-value'].strip())
end_value = float(tag['end-with-value'].strip())
if start_value > end_value and start_value != 0.0 and end_value != 0.0:
raise utils.ValidationError(
'Start value should not be greater than End value in Video tag.'
) so I guess this is what causes the NonStrictValidationError when using a start time larger than the end time. |
Hi again @seanlip, was this the code you were looking for? |
Thanks @yungmulah, sorry for the late reply (I was travelling and just got back). Yes, that code is the correct one. Please change it to prevent equality as well, so that the frontend and backend code are fully consistent. Thanks! |
@yungmulah are you still working on this issue? |
Deassigning @yungmulah due to lack of response. To new contributors: a lot of progress has been made in #19179 already. Please take a look at that PR and make the final changes needed. To claim this issue, you should demonstrate that those changes work and explain how you addressed the open review comments. Thanks! Note: it's probably also worth addressing #18508 (comment) similarly if it's still an issue (i.e., don't allow SkillReview components to be saved if the relevant fields aren't populated). |
Hello! @seanlip |
Here is a video of the implementation. When start is equal or greater than end, and the user tries to click "Done", an error is displayed to the user. Clicking "Done" and saving is only possible when the condition is met. Screen.Recording.2024-03-23.at.13.10.44.mov |
Hi @alice21mota, thanks for looking into this issue. Please take the PR from @yungmulah as your starting point, it has already been refined through a lot of comments and we should get that in properly. Instead of having a new approach as you do here, could you please iterate on that previous approach and address any remaining comments so that you have something that works properly and is generalizable? Thanks! |
Hello @seanlip, thank you so much for your answer! |
@alice21mota I mean the remaining comments in #19179 -- I would advise starting from that PR as a basis and fixing whatever's left from the most recent review, instead of your proposed approach. |
Thank you @seanlip! Will do that, and propose a solution as soon as possible. |
Hello @seanlip! I started from @yungmulahand 's PR and fixed the few things that were remaining. Here is the video with the bug fixed. What should I do next? Should I open a PR? Thanks for the help in advance :) Oppia.-.Google.Chrome.2024-03-24.17-43-47.mp4 |
Hi @joanapeixinho -- yes, feel free to open a PR for this. Also, please reply to the comments in #19179, linking to your PR and explaining how you addressed the comment (or just saying "Done" if it's straightforward). Thanks! |
…onent modal when start time is greater than end time
@joanapeixinho I think you left a comment asking about where to leave questions, but I can't see it any more. The answer is that you can leave that question anywhere, either here or in the other PR. I think I'd probably suggest doing it here with a clear link to the specific comment on the other PR, so that it remains part of this conversation. Thanks! |
Also @joanapeixinho just to check, when will you be able to open the PR? |
@seanlip I just have to resolve a problem I'm having with the frontend tests that I think is due to my virtual enviroment. It's actually taking some more time than I anticipated since I also have uni classes but hopefully by tomorrow I can have everything solved and do the PR. |
…onent modal when start time is greater than end time
…ation Editor (#20071) * fix #18211: Unexpected error on Exploration Editor page RTE * Fix typo on create-activity-modal.component.spec.ts * fix typo on rte-helper.service.spec.ts * unsubscribe from customizationArgsFormSubscription in rte-helper-modal.controller.spec.ts * Update initialization for test when customization args has a valid youtube video * Fix indentation in beforeEach block * Refactor customizationArgsDict assignment in RteHelperModalComponent * Update save and cancel functions in RteHelperModalController * Update test for when customization args has a valid youtube video * Update save function rte-helper-modal.controller.ts * Fix formating error in rte-helper-modal.controller.ts * Update rte-helper-modal.controller.ts * add test in rte-helper-modal.controller.spec.ts for when the text is empty in link form control * Update rte-helper-modal.controller.ts
…xploration Editor (oppia#20071) * fix oppia#18211: Unexpected error on Exploration Editor page RTE * Fix typo on create-activity-modal.component.spec.ts * fix typo on rte-helper.service.spec.ts * unsubscribe from customizationArgsFormSubscription in rte-helper-modal.controller.spec.ts * Update initialization for test when customization args has a valid youtube video * Fix indentation in beforeEach block * Refactor customizationArgsDict assignment in RteHelperModalComponent * Update save and cancel functions in RteHelperModalController * Update test for when customization args has a valid youtube video * Update save function rte-helper-modal.controller.ts * Fix formating error in rte-helper-modal.controller.ts * Update rte-helper-modal.controller.ts * add test in rte-helper-modal.controller.spec.ts for when the text is empty in link form control * Update rte-helper-modal.controller.ts
Describe the bug
When creating an exploration on the Creator Dashboard page, if a video is added from RTE with a start time greater than the end time, the site reloads and displays an unexpected error of
nonStrictValidationFailure
Error Trace:
nonStrictValidationError: [{"cmd":"edit_state_property","new_value":{"html":"<oppia-noninteractive-video _nghost-mdr-c48=\"\" autoplay-with-value=\"true\" end-with-value=\"10\" ng-version=\"11.2.14\" start-with-value=\"12\" video_id-with-value=\"&quot;adJFT6_j9Uk&quot;\"></oppia-noninteractive-video>","content_id":"content_0"},"old_value":{"html":"","content_id":"content_0"},"property_name":"content","state_name":"Introduction"}]
Steps To Reproduce
Expected Behavior
When the user inputs a start time that is longer than the end time, as is done when the user adds a start or end time that is negative, the user shouldn't be allowed to select "Done."
Screenshots/Videos
start_greater_end.mp4
What device are you using?
Desktop
Operating System
Windows
What browsers are you seeing the problem on?
Edge
Browser version
No response
Additional context
Similar Issue: #18204
The text was updated successfully, but these errors were encountered: