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

Allow equipment check-out / check-in date to be changed #1389

Open orenyk opened 8 years ago

orenyk commented 8 years ago

It's been requested that the check-in / check-out time be modifiable for cases where the staff don't process equipment in Reservations immediately after it's been handed out or returned. Not sure the best way to handle this, let's discuss and figure it out.

orenyk commented 8 years ago

Note that we'll need to find a timepicker to go along with the jQuery UI Datepicker we already use - a quick Google search found a few options so we should investigate.

alex-kogan commented 8 years ago

I'll try to take a stab at it, will dive into it over the weekend

alex-kogan commented 8 years ago

I'm looking at the issue, and I'm trying to find which controller is involved and I quickly realized that I don't understand the issue completely. @orenyk as the person who opened the issue could you shed some light ion it?

orenyk commented 8 years ago

Sure. Steps to replicate:

  1. Create reservation
  2. Check out reservation
  3. Visit edit reservation form (/reservations/:id/edit)

Expected: there is a field that allows for the checkout date and time to be edited Actual: no such field

We'd have another field to edit the checkin date/time as well, although these fields would only show up if the reservation has already been checked out and/or checked in. Part of the issue is that our jQuery datepicker only supports dates, but not times as well, so we'd have to figure out how to input times.

Hope that helps!

alex-kogan commented 8 years ago

@orenyk - As mentioned at the scrum meeting, the functionality is up and running. I've been trying to write the specs for this functionality (i.e. changing the checkout/checkin times) regardless of the timepicker.

I'm trying to build off the existing reservation controller but I've experienced some difficulties. The reservation that is used in the specs doesn't have a checkout time (even in the spec that says: 'with checked out equipment item').

Any ideas on how to go about it? my initial idea is to create a reservation with a checkout and checkin time and then try to change them.

Edit - @orenyk any ideas?

orenyk commented 8 years ago

You should be able to set the initial checkout / checkin time directly (e.g. @reservation.update_attributes(checked_out: Time.zone.now, checked_in: Time.zone.now + 1.day)) and then test that they change to some new values once you execute the request. Does that help?

alex-kogan commented 8 years ago

Yup! done creating a pull request