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

Frontend form error handling #125

Merged
merged 9 commits into from
Feb 20, 2025
Merged

Frontend form error handling #125

merged 9 commits into from
Feb 20, 2025

Conversation

Yasoop
Copy link
Contributor

@Yasoop Yasoop commented Feb 6, 2025

Description

Redirects to a different page if the review form is unsuccesful. Toast popup happens when exiting to home page.

Motivation and Context

Handles backend review form error.
Closes #114

How has this been tested?

Tested errors by putting more than 2 reviews in one cycle and submitting more than 5 reviews total

Screenshots (if appropriate):

If there are more than two reviews in a cycle or more than 5 reviews are submitted, then the submit button on the last page of the form is clicked, redirects to this page.
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have moved the ticket to "In Review"
  • I have added reviewers to this PR
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Yasoop Yasoop requested a review from banushi-a February 6, 2025 23:40
Copy link

vercel bot commented Feb 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cooper ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 11:20pm
cooper-auth ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 11:20pm
cooper-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 11:20pm

Copy link
Contributor

@banushi-a banushi-a left a comment

Choose a reason for hiding this comment

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

This is a good start so far. I think we should also try and do some error handling earlier in the form as well. Check the updated ticket for the new requirements which I think make the user experience better.

Copy link
Contributor

@banushi-a banushi-a left a comment

Choose a reason for hiding this comment

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

small requested changes, great progress

@banushi-a
Copy link
Contributor

banushi-a commented Feb 17, 2025

I think I figured out how we can stop them before they get too far:

If you look at the screenshot below, I added a check in the next function to make sure that they aren't submitting too many reviews. The way we do this is fetch all of the users reviews once they open the form, this way we have them loaded in memory. Once they are on the cycle page, they can enter any term, but if they already did 2 reviews, they will be stopped!

Since most of the boilerplate is there, try and see if you can implement the logic in the //Todo on your own @Yasoop !

(also remove the console.log lol)

Screenshot 2025-02-16 at 9 39 46 PM

@banushi-a
Copy link
Contributor

For the formatting @Yasoop @suxls if you have prettier installed as a vscode extension you should be able to just save the file and it reformats. If this doesn't work for you follow this quick guide: https://www.digitalocean.com/community/tutorials/how-to-format-code-with-prettier-in-visual-studio-code

Copy link
Contributor

@banushi-a banushi-a left a comment

Choose a reason for hiding this comment

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

lfg

@Yasoop Yasoop merged commit dc8a790 into main Feb 20, 2025
8 checks passed
@Yasoop Yasoop deleted the form-error-handling branch February 20, 2025 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Develop) Handle Errors in Review Form
3 participants