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

Commit 1c87731

Browse files
committed
minor change
1 parent c30c441 commit 1c87731

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

app/controllers/reservations_controller.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
class ReservationsController < ApplicationController
44
load_and_authorize_resource
55

6-
76
before_action :set_user, only: [:current, :checkout]
87

98
private
@@ -210,7 +209,7 @@ def update # rubocop:disable all
210209
end
211210

212211
# update the item history / histories
213-
old_item.make_switch_notes(reservation, r, current_user) if old_item
212+
old_item&.make_switch_notes(reservation, r, current_user)
214213

215214
new_item.make_switch_notes(r, reservation, current_user)
216215
end

lib/checkout_helper.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ def self.checkout_reservation(r, reservations)
99
new_notes, r.checked_out)
1010
end
1111

12+
def self.checkin_reservation(r, reservations)
13+
r.save!
14+
# update equipment item notes
15+
new_notes = reservations[r.id.to_s][:notes]
16+
r.equipment_item.make_reservation_notes('checked in', r,
17+
r.checkin_handler, new_notes,
18+
r.checked_in)
19+
end
20+
1221
def self.reservation_for(r_id, r_attrs, user)
1322
return if r_attrs[:equipment_item_id].blank?
1423
r = Reservation.includes(:reserver).find(r_id)
@@ -43,15 +52,6 @@ def self.update_tos(user)
4352
user.update_attributes(terms_of_service_accepted: true)
4453
end
4554

46-
def self.checkin_reservation(r, reservations)
47-
r.save!
48-
# update equipment item notes
49-
new_notes = reservations[r.id.to_s][:notes]
50-
r.equipment_item.make_reservation_notes('checked in', r,
51-
r.checkin_handler, new_notes,
52-
r.checked_in)
53-
end
54-
5555
def self.preproccess_checkins(reservations, user)
5656
checked_in_reservations = []
5757
reservations.each do |r_id, r_attrs|

0 commit comments

Comments
 (0)