-
Notifications
You must be signed in to change notification settings - Fork 57
Patrons unable to make reservations after being granted an exception #297
Conversation
You are correct that restrictions extend past a single reservation. By their very nature they have to, otherwise patrons could create separate reservations to get around certain limits. For example, if a patron wanted tries to bypass restrictions by reserving 3 cameras separately, rather than the defined limit of 1, we have to check each reservation against their other reservations to validate that they haven't exceeded the limit during that time period (i.e. overlapping reservations). There are a few ways of solving this that I can think of, each with pros and cons:
For example, if we built this is, the student above could reserve an additional projector during that period despite having 2 out already.
-Adam On Dec 17, 2012, at 11:22 AM, lauratomas notifications@github.com wrote:
|
I agree, implementing the reservation request feature would be the best way to work with these exceptions. There are some things we might be able to do with SN request forms and frames, but I'm not sure if y'all want go in that direction. |
This has been a recurring problem and we've opened up a whole bunch of issues for it (see everything merged into #318, for example). Ultimately, we need to figure out a mechanism through which admins can grant exceptions when necessary without removing the user's ability to make new valid reservations for themselves. |
This is a big part of #206, but since they're not quite the same I'm leaving them both open. Any solution to that issue needs to also solve this one. |
I've been playing around with this (w/ #206) in gedit, and here's my thoughts for how to implement these together: BASIC IDEA:
FOR MY OWN THOUGHTS, SUGGESTIONS WELCOME:needed for reservation requests:
EDIT: updated 25 June 2014 with progress / strikethroughs. basically what's left:
|
This is fantastic, great work! I'm on my phone so can't look at the whole thing while commenting, but one thing that stuck with me was the invalid request thing (e.g. reservation cannot physically be made for some reason). I think we can safely just treat those as rejected without loss of functionality, it preserves the history while allowing for us to bypass valuations. If we want, we could also add a |
I have not yet written tests for these, and did not include emailing the patron or admin of pending or approved or denied requests. The requests functionality is here, though. I would like to code review this first myself, because the rebasing has been awful and I want to double-check all the changes I've committed. |
# the attribute is called from_admin, but now that we can give checkout people this permission, the name doesn't quite make sense. | ||
@reservation.from_admin = (can? :override, :reservation_errors) | ||
|
||
if (can? :override, :reservation_errors) or @errors.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be possible to move this check/assignment out of the do-loop (for efficiency) and add it to params[:reservation].
@@ -71,27 +70,41 @@ def create | |||
respond_to do |format| | |||
Reservation.transaction do | |||
begin | |||
@errors = Reservation.validate_set(cart.reserver, cart.cart_reservations) | |||
if (can? :override, :reservation_errors) or @errors.empty? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to bypass any validation errors without displaying them. They should probably be displayed in both cases, one with "Reservations created successfully, despite containing the following errors: " and the other with "Reservations filed as requests pending administrator approval, as they contain the following errors: "
It's not clear if this control flow doesn't obscure error and privilege case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hesitant to output all errors to the admin again in a flash[:notice]. For one thing, flash notices don't support bullet points, but also, the error messages were all just outputted on the previous screen (the New method in the controller; this one's Create). However, I do think it's reasonable to remind the admin that they've just bypassed validations, so I'll add that case in the if/else conditional.
Just checked this out and it feels solid. I trust @shippy to have done a good job with the actual code review so if you think it's good, go ahead and sort out those merge conflicts. |
okay, I'm gonna try to merge this nowish... |
gl |
ty! the second merge has produced a viable gemlock. |
Patrons can now request reservations when their cart fails validations.
Patrons are unable to create additional reservations during the same time frame as extended reservations (those that break rules regarding reservation length and number of equipment items). In BMEC reservations:
Reservations # 249 and 250 are six-day reservations for the same equipment model. These reservations required admin approval. Patron attempted but failed to create reservation # 1108 herself for the standard three-day checkout and for a different equipment model. It looks like equipment restrictions are extending past a single reservation?