planner icon indicating copy to clipboard operation
planner copied to clipboard

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

Open frontendfran opened this issue 2 years ago • 3 comments

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

frontendfran avatar Aug 09 '22 18:08 frontendfran

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 avatar Aug 20 '22 04:08 joaoguiIherme

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

joaoguiIherme avatar Aug 20 '22 18:08 joaoguiIherme

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.

github-actions[bot] avatar Nov 19 '22 00:11 github-actions[bot]