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

Commit a1ef04a

Browse files
committed
Fix bugs with #1498
1 parent 5a7c685 commit a1ef04a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/controllers/equipment_models_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@ def type_from_file_command(file)
189189

190190
def calculate_availability # rubocop:disable all
191191
# get start and end dates
192-
@start_date = Date.today.beginning_of_week(:sunday)
193-
@end_date = (Date.today + 1.month).end_of_week(:sunday)
192+
@start_date = Time.zone.today.beginning_of_week(:sunday)
193+
@end_date = (Time.zone.today + 1.month).end_of_week(:sunday)
194194

195195
# hack-y, we have a proper scope in master for this
196196
reservations =
197-
Reservation.for_eq_model(@equipment_model).finalized
197+
(Reservation.for_eq_model(@equipment_model).active
198198
.where('start_date <= ? and due_date >= ?', @end_date, @start_date) + \
199-
Reservation.for_eq_model(@equipment_model).overdue
199+
Reservation.for_eq_model(@equipment_model).overdue).uniq
200200
max_avail = @equipment_model.equipment_items.active.count
201201

202202
@avail_data = []

0 commit comments

Comments
 (0)