You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 24, 2020. It is now read-only.
Copy file name to clipboardexpand all lines: app/models/equipment_model.rb
+23-3
Original file line number
Diff line number
Diff line change
@@ -157,9 +157,9 @@ def photos
157
157
self.documents.images
158
158
end
159
159
160
-
defavailable?(date_range)#This does not actually return true or false, but rather the number available.
160
+
defavailable?(date_range)#This does not actually return true or false, but rather the number available.
161
161
qualification_met=true
162
-
if((a=BlackOut.date_is_blacked_out(date_range.first)) && a.black_out_type_is_hard) || ((a=BlackOut.date_is_blacked_out(date_range.last)) && a.black_out_type_is_hard)#If start or end of range is blacked out, and that is a hard blackout.
162
+
if((a=BlackOut.date_is_blacked_out(date_range.first)) && a.black_out_type_is_hard) || ((a=BlackOut.date_is_blacked_out(date_range.last)) && a.black_out_type_is_hard)#If start or end of range is blacked out, and that is a hard blackout.
163
163
return0
164
164
end
165
165
overall_count=self.equipment_objects.size
@@ -170,7 +170,7 @@ def available?(date_range) #This does not actually return true or false, but rat
170
170
overall_count
171
171
end
172
172
173
-
defmodel_restricted?(reserver_id)#Returns 0 if the reserver is ineligible to checkout the model.
173
+
defmodel_restricted?(reserver_id)#Returns 0 if the reserver is ineligible to check out the model.
# then subtract the total quantity currently checked out, reserved, or overdue
190
190
# TODO: the system does not account for early checkouts; but early checkouts are no longer possible, so non-issue?
191
+
# Note that reserved_count also includes the number of reservations currently checked out
191
192
192
193
reserved_count=Reservation.where("checked_in IS NULL and equipment_model_id = ? and start_date <= ? and due_date >= ?",self.id,date.to_time.utc,date.to_time.utc).size
193
194
overdue_count=Reservation.where("checked_in IS NULL and checked_out IS NOT NULL and equipment_model_id = ? and due_date <= ?",self.id,Date.today.to_time.utc).size
0 commit comments