Skip to content
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

feat: adjusted grade field validation #382

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dyudyunov
Copy link
Contributor

@dyudyunov dyudyunov commented Feb 7, 2024

Description

Added simple validation for the "Adjusted grade" field in the "Edit Grades" popup:

  • allow only a numeric value
  • define the minimum value (0)
  • checking the correctness of the entered possibleGrade value

Notes

This was already merged in nutmeg and maple, but the PR to the master branch wasn't open at that time.

Steps to reproduce

  1. Go to Instructor -> Student admin -> View Gradebook
  2. Click on any user
  3. In the Adjusted grade field fill in symbols, letters, a large number

Behaviour before the fix

Entering the large number has no errors and it's possible to save the incorrect value:
image
image

Entering text/special symbols results in 500 errors for the request:
image
image

@dyudyunov dyudyunov requested a review from a team as a code owner February 7, 2024 13:47
@openedx-webhooks
Copy link

openedx-webhooks commented Feb 7, 2024

Thanks for the pull request, @dyudyunov!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @farhaanbukhsh. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.02%. Comparing base (ba9bd46) to head (5aba8f2).
Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #382      +/-   ##
==========================================
+ Coverage   94.98%   95.02%   +0.03%     
==========================================
  Files         140      140              
  Lines        1357     1366       +9     
  Branches      264      269       +5     
==========================================
+ Hits         1289     1298       +9     
  Misses         60       60              
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mphilbrick211 mphilbrick211 added the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Feb 21, 2024
@farhaanbukhsh
Copy link
Member

@mphilbrick211 I can take the review for this.

@arbrandes arbrandes self-requested a review March 4, 2024 17:09
@arbrandes
Copy link
Contributor

@dyudyunov, do you mind adding testing instructions and screenshots to the PR description?

@mphilbrick211
Copy link

Thank you, @farhaanbukhsh!

@dyudyunov
Copy link
Contributor Author

hi @arbrandes

I updated the description, please check

@arbrandes arbrandes added the bug Report of or fix for something that isn't working as intended label Mar 5, 2024
@arbrandes
Copy link
Contributor

In trying to reproduce this I found another bug, but yeah, this is definitely an issue.

@arbrandes
Copy link
Contributor

Here's what I'm thinking:

  1. The proposed changes don't fix the symbols problem. You can still enter garbage, and you'll still get a 500 error.
  2. The validation is doing more than just validation. I believe we should be blocking submission and showing an error message, instead of trying to guess what the user was trying to do.

Is this something you have time to tackle here?

Copy link
Contributor

@arbrandes arbrandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

@mphilbrick211 mphilbrick211 removed the waiting for eng review PR is ready for review. Review and merge it, or suggest changes. label Mar 5, 2024
@dyudyunov
Copy link
Contributor Author

I lost this issue somehow. Added it to my TODO list now. I'll give updates asap

@dyudyunov
Copy link
Contributor Author

dyudyunov commented Apr 1, 2024

@arbrandes could you clarify your proposals?

The proposed changes don't fix the symbols problem. You can still enter garbage, and you'll still get a 500 error

With current changes, the "Adjusted grade" field only allows input of numbers in a dedicated range.
How can I reproduce the issue you're describing?

@mphilbrick211
Copy link

@arbrandes could you clarify your proposals?

The proposed changes don't fix the symbols problem. You can still enter garbage, and you'll still get a 500 error

With current changes, the "Adjusted grade" field only allows input of numbers in a dedicated range. How can I reproduce the issue you're describing?

Bumping this for you, @arbrandes!

adjustedGradeValue = 0;
break;
case possibleGrade && target.value > possibleGrade:
adjustedGradeValue = possibleGrade;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point was that instead of artificially modifying the number the user was trying to enter, we should show an error message instead. This is so they can understand what the problem was.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

The proposal makes sense, but I can't say when I'll have time to implement it (too loaded now with other stuff)

} = useAdjustedGradeInputData();
return (
<span>
<Form.Control
type="text"
type="number"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tested this, I was still able to enter non-numeric characters. It could be that this is a Paragon bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange, I'm sure I tested that 🤔
I was able to use numbers, ., and , only

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's because of the different Paragon versions. If I remember correctly - I tested it on Quince

@arbrandes
Copy link
Contributor

I believe #366 is more in line with what I'm thinking.

@mphilbrick211
Copy link

Hi @dyudyunov and @arbrandes - is this still in progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report of or fix for something that isn't working as intended open-source-contribution PR author is not from Axim or 2U
Projects
Status: In Eng Review
Status: In review
Development

Successfully merging this pull request may close these issues.

6 participants