-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: validation and error display for due date extensions in the API #36187
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @efortish! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.
|
Hello @mariajgrimaldi , could you help me with the review of this PR? I will also refine the issue with some things I found. |
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.
Hi @efortish! Thanks for your contribution. I was testing the changes and everything works fine! I only have a few minor comments.
- Remove the trailing spaces in the function. I recommend using trailing spaces extension in VSCode.
- Remove the double line break in the function.
As a suggestion, It's possible to add a margin in the error message?
Fix validation and error display for due date extensions in the API
Description
This PR addresses the issue where the API did not correctly handle and display error cases where the due_datetime field was empty or incorrectly formatted; also, the API did not correctly handle the student/email field when it does not exist. Additionally, this PR ensures that the error messages returned by the API are clear and relevant to the actual validation error encountered.
This is the fix for this issue
Changes Made
Consistent Error Handling:
Detailed Error Message:
Objective
The objective of these changes was to improve the user experience by providing clear and accurate error messages when validation fails. This helps users understand what went wrong and how to correct their input.
Achievements
Improved User Feedback: Users now receive specific error messages for each validation issue, making it easier to correct their input.
Consistent Error Handling: All validation errors are handled consistently, making the API more robust and predictable.
Better Code Organization: The validation checks are now logically ordered, improving the readability and maintainability of the code.
Testing
Tested with various inputs to ensure that the correct error messages are returned for each validation failure.
Verified that the frontend correctly displays the error messages returned by the API.
How to test
In the lms, go to the Extensions section in the instructor dashboard and try different inputs, you can:
Note: Please keep in mind that the input "reason" is not required in the serializer, therefore it doesnt matter whether it is filled out or not
Screencast.from.2025-01-28.11-49-33.webm
Related Issues
PR #35392: https://github.com/openedx/edx-platform/pull/35392/files#diff-2e708ec7862cbe8e9fe138f4cde50b224d98e95f958dfc645b5ab76075035d8dR2994-R3008
Issue #124: Errors are not displayed correctly in extensions tab #124
Issue #422: [Test failure] TC_INSTRUCTOR_8: Errors are not displayed correctly in extensions tab #422