7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/models/alert.rb', line 7
def get_shift
if self.alert_type == "Time Off"
Timeoff.find_by_id(self.alert_type_id)
elsif self.alert_type == "Cancellation"
@cancellation = Cancellation.find_by_id(self.alert_type_id)
if !@cancellation.nil?
@cancellation.shift
end
elsif self.alert_type == "Late Notice"
@lateness = Lateness.find_by_id(self.alert_type_id)
if !@lateness.nil?
@lateness.shift
end
elsif self.alert_type == "Swap"
@swap = Swap.find_by_id(self.alert_type_id)
if !@swap.nil?
@swap.shift
end
elsif self.alert_type =="unavailable"
@unavailable = Unavailable.find_by_id(self.alert_type_id)
if !@unavailable.nil?
@unavailable.shift
end
elsif self.alert_type =="Fill Shift"
Shift.find_by_id(self.alert_type_id)
end
end
|