Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Calendar availability incorrect #1218

Closed
orenyk opened this issue Apr 3, 2015 · 12 comments · Fixed by #1232
Closed

Calendar availability incorrect #1218

orenyk opened this issue Apr 3, 2015 · 12 comments · Fixed by #1232

Comments

@orenyk
Copy link
Contributor

orenyk commented Apr 3, 2015

This issue relates to the broken calendar view noted below; the issues with renewals were fixed in the #416 branch.


While writing tests for renewals for #416 I came across a weird bug. The calendar / Reservations doesn't consider the equipment occupied on the due date, and neither does the renewal code. Steps to replicate:

  1. Create reservation from Time.zone.today until Time.zone.today + 1.day (for equipment model with a single equipment item)
  2. Check out said reservation
  3. Create reservation for same equipment model from Time.zone.today + 2.days until Time.zone.today + 3.days
  4. Visit reservation page of first reservation
    • Expected: reservation cannot be renewed
    • Actual: reservation can be "renewed" until due date; clicking the link issues a valid renewal request but nothing changes
  5. Visit the equipment model page
    • Expected: equipment has no availability from today until Time.zone.today + 4.days in the calendar
    • Actual: equipment is unavailable today, and for the duration of the upcoming reservation, but is considered available on its due date

This might be resolved in #462, or it might not 😛.

Screenshots

selection_057

selection_056

@orenyk
Copy link
Contributor Author

orenyk commented Apr 3, 2015

Note that when I tried to create a reservation starting on the due date I'm pretty sure the cart validation for availability failed... I'd have to double-check though.

@orenyk
Copy link
Contributor Author

orenyk commented Apr 3, 2015

Another note: manually editing the second reservation to start on the due date of the first fixes the calendar issue but not the renewal issue.

@orenyk
Copy link
Contributor Author

orenyk commented Apr 3, 2015

Ok, so I've figured part of this out. The eligible_for_renew? method only checks based on how many times its been renewed and how close it is to the due date, not if there are actually days available to extend the reservation. I'm inclined to add a check to the method for equipment_model.available_count(due_date + 1.day) > 0 and hopefully that will fix things. I'll probably implement this in the #416 branch so I can write those specs.

@orenyk orenyk modified the milestones: 5.2.0, 5.3.0 Apr 3, 2015
@orenyk orenyk self-assigned this Apr 3, 2015
@orenyk orenyk modified the milestones: 5.3.0, 5.2.0 Apr 3, 2015
@orenyk
Copy link
Contributor Author

orenyk commented Apr 3, 2015

Verified - a reservation is no longer eligible_for_renew? if there is no equipment available on the day following its due date. This also prevents the renew method from happening if find_renewal_date simply returns the current due date (which is how it behaves if it can't find an eligible renewal date following the due date). I'll leave this issue open to resolve the JS weirdness.

orenyk added a commit that referenced this issue Apr 3, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issue with renewals (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
@orenyk
Copy link
Contributor Author

orenyk commented Apr 7, 2015

I'm not sure this is still an issue but while checking out #1121 I noticed that an overdue reservation will be considered eligible for renewal. I'll investigate in the #416 branch...

orenyk added a commit that referenced this issue Apr 8, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issue with renewals (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
orenyk added a commit that referenced this issue Apr 16, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issue with renewals (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
@orenyk
Copy link
Contributor Author

orenyk commented Apr 19, 2015

Confirmed, you can renew an overdue reservation. I'm going to make the fix in the #416 branch and focus on the JS weirdness.

orenyk added a commit that referenced this issue Apr 20, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issues with renewals (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
@orenyk
Copy link
Contributor Author

orenyk commented Apr 20, 2015

Apparently we had a test specifying that overdue reservations should be eligible for renewal, which makes no sense to me. We'll fix that :-)

orenyk added a commit that referenced this issue Apr 20, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issues with renewals and add specs (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
orenyk added a commit that referenced this issue Apr 20, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issues with renewals and add specs (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
orenyk added a commit that referenced this issue Apr 20, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issue with renewals (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
orenyk added a commit that referenced this issue Apr 21, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issues with renewals and add specs (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
- refactored the for_eq_model Reservation scope not to call .finalized
@orenyk
Copy link
Contributor Author

orenyk commented Apr 22, 2015

Fixed the JS weirdness, it's always the freaking time zones 😠! Thankfully @squidgetx wrote a dateInTimeZone method that I threw in to keep everything consistent. I believe this is now fixed, opening a PR momentarily.

orenyk added a commit that referenced this issue Apr 22, 2015
Resolves #1218
- use dateInTimeZone instead of new Date for consistency
@orenyk orenyk changed the title Renewal / Calendar weirdness Calendar availability incorrect Apr 22, 2015
@squidgetx
Copy link
Contributor

It's a problem with our current system because then those overdue "days" are lost from record, but I don't see a higher level conceptual reason why overdue equipment should be ineligible for renewal. The way a lot of libraries work is that they keep track of how many overdue days a book has. If you renew an overdue book your fine stops increasing, but you still have to pay it.

@orenyk
Copy link
Contributor Author

orenyk commented Apr 22, 2015

And then you'd rely on the other equipment availability / reservation length / renewal validations to restrict the ultimate reservation length? I'm not sure I like that since then you could just remain overdue for a while, and then "renew" at the end to get some extra free days even if it's beyond the usually acceptable length. Someone with an overdue reservation should be encouraged to return it ASAP, not given the option to just keep it. If they want to bring it back and immediately re-reserve it at the counter to end their overdue reservation but keep the equipment that's fine, but I don't think they should be given the option to keep the equipment for free once they've gone past the due date without coming in to the office (it's not like they don't get a reminder e-mail).

orenyk added a commit that referenced this issue Apr 24, 2015
Resolves #416
- add tests for Reservation actions (creation, equipment handling, renewal)
- add tests for Rails Admin routes
- resolve issues with renewals and add specs (see #1218)
- add numerous helpers for integration tests
- misc cleanup of other tests
- resolve deprecation warning reintroduced by #1081
- clean up tests from #987
- refactored the for_eq_model Reservation scope not to call .finalized
orenyk added a commit that referenced this issue Apr 24, 2015
@squidgetx
Copy link
Contributor

Ah, you're right. Most library systems have a key "hold" feature that I forgot about that makes this more economical: other patrons can put an item on hold. Then no one can renew it. That itself might be a worthwhile future feature though. For now, we should probably not allow overdue renewals.

@orenyk
Copy link
Contributor Author

orenyk commented May 10, 2015

Well that's basically what our "reservations" are, right? 😛

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants