bridge_troll
bridge_troll copied to clipboard
Validate that all attendee RSVPs have at least one session
It's okay for organizer RSVPs not to have one, but for students and volunteers they should've cancelled their session instead of unchecking all boxes.
Adding the validation is pretty simple, the problem is making it not invalidate the ~400+ extant records that have no rsvp_sessions. Options:
- Only make the validation apply if the event is
upcoming?
- Delete any old rsvps that don't have associated sessions (they probably didn't go...)
- For old rsvps without sessions, make an
rsvp_session
for everyevent_session
(it's the default...)
Probably only the first option is good, but it leads to more mind-juggling about when data is or isn't valid.
[imported from Pivotal Tracker on 11/8/15, original story by @tjgrathwell]
@maxjacobson and I took a look at this issue and found that several validations are already in place:
front end:
- in the html view, the checkboxes are disabled for student users on all event sessions req'd for students: https://github.com/railsbridge/bridge_troll/blob/5ab4c604c81624518c459e31f95c87bd564be951/app/views/rsvps/_form.html.erb#L102
back end:
-
in #rsvp_params, we add required session ids even if they haven't been selected on the form: https://github.com/railsbridge/bridge_troll/blob/5ab4c604c81624518c459e31f95c87bd564be951/app/controllers/rsvps_controller.rb#L125-L129
-
for non-organizers, for upcoming events, we already validate that you rsvp to at least one session: https://github.com/railsbridge/bridge_troll/blob/5ab4c604c81624518c459e31f95c87bd564be951/app/models/rsvp.rb#L52-L54
-
if you manage to create an rsvp without any sessions, we encourage you to cancel it: https://github.com/railsbridge/bridge_troll/blob/5ab4c604c81624518c459e31f95c87bd564be951/app/views/rsvps/_form.html.erb#L9-L13
Given these validations already in place, maybe we do not need further validation?