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

Organisers can create new Sponsors without adding in number of coaches/students but it will 404 #1794

Open
7 tasks
frontendfran opened this issue Aug 9, 2022 · 3 comments

Comments

@frontendfran
Copy link

frontendfran commented Aug 9, 2022

Description of the issue 📄

An organiser user admin is able to create a new sponsor page with 0 coaches or students assigned to it, even though this is not allowed and the page will 404 once created. If there are 0 students set, the field will be validated as correct in the input field (see screenshot attached). The students/coaches field is not marked as required in the UI with an asterisk even though it should be.

Given that an admin is on the 'New sponsor' page in the admin panel,
When the admin has not put any number of students or coaches,
Then the admin will be taken to a sponsorship page that gives a 404.

Screenshots 📷

Screenshot 2022-08-09 at 19 27 41

Screenshot 2022-08-09 at 19 40 05

Steps to fix 🛠

To do 📋

  • Claim this issue (comment below, or assign yourself if you are part of the codebar org)
  • Fork and clone the repository
  • Update the relevant files. Follow the steps to fix section in this issue.
  • Commit your changes as one commit. Use the title of this issue as your commit message
  • Submit a pull request
  • Mention this issue in the PR description by including it's number
  • Have your pull request reviewed & merged by a codebar team member
@joaoguiIherme
Copy link
Contributor

joaoguiIherme commented Aug 20, 2022

So, is the solution make coach/student as required fields? sponsor.seats has a default value of 15 while sponsor.number_of_coaches has not and when the user fill with blank it comes with nil value causing the error. Do you think the best approach is to create a default value for number_of_coaches or just mark it as required in the view?

@joaoguiIherme
Copy link
Contributor

joaoguiIherme commented Aug 20, 2022

IMHO, the best approach is to validate in the server side and client side with the required. I can implement it.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

No branches or pull requests

3 participants