YaleSTC/reservations — pull request #628 by squidgetx (2014-07-07 16:42:02+00:00)
Title: Catalog render takes forever

My benchmarking has suggested that the catalog render is the largest source of slowdown when updating the cart. This is because of the large number of calls to `.available?` (one for every day for every eq model).

Suggested optimisation: since eventually every reservation is called to check .available, get all the data we need to work with in a single query instead of issuing many separate queries.

similarly refactor .available so it can issue one query for the date range it needs as opposed to gathering all reservations for each day in the date range.