YaleSTC / reservations

Manage equipment loans & reservations. Who can borrow what, for how long?
yalestc.github.io/reservations
MIT License
139 stars 57 forks source link

Make Hard Blackouts a "hard" validation #1490

Open orenyk opened 8 years ago

orenyk commented 8 years ago

2016/06/16

See below for the original motivation - we want to prevent both valid reservations and requests from being created such that they overlap with Hard Blackouts. I suspect that this can be accomplished through an ActiveRecord-validation, but we'd have to make sure.

Original

Requested by ITG:

We are interested in turning off all future reservations while we reorganize and assess our inventory. I looked under settings but there does not seem to be a clear method of doing so. Would you know how we can turn off reservations?

This was not something we'd previously considered; I suggested creating a hard blackout date to prevent patrons from creating reservations but it's not a great fix since they can still create requests. I'm envisioning the following:

Thoughts? If we can get this into v5.5.6 that would be awesome.

EDIT On second thought we don't need this to go in v5.5.6, let's just bump it to v6.1.0

esoterik commented 8 years ago

Making hard blackouts disable requests and making end dates on blackouts optional could fix this, right? I think the functionality overlaps enough that adding a new setting isn't necessary, plus if old blackouts aren't deleted there's a record of the dates where reservations were disabled.

orenyk commented 8 years ago

I agree, although I think we might still want to add a requests on/off switch (this was requested separately by BMEC a few weeks ago and I forgot to create a new issue). I'm going to make that a separate issue regardless, so we can change this issue to simply making hard blackouts an AR-level validation (like availability), which I believe should prevent requests from overlapping with hard blackouts.

We can try to swing this into v6 later in the summer, I don't think it's that urgent.

esoterik commented 8 years ago

I have this almost completed, but it still brings up the request prompt when the validation fails. Fixing that will be much easier after #1624 is merged because I cleaned up ReservationsController#create and ReservationsController#new, and added a more detailed "Reservation Denied" page.

Blocking on #1624 for now.