Class: NextSgad::Justification

Inherits:
ApplicationRecord show all
Defined in:
app/models/next_sgad/justification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#create_number, #create_number!

Instance Attribute Details

#datesObject

disapproved if both disapproved approved if both approved pending if both pending in_progress if not first, second nor third



15
16
17
# File 'app/models/next_sgad/justification.rb', line 15

def dates
  @dates
end

Instance Method Details

#daysObject

Return an arrays of dates associated to this justification



38
39
40
# File 'app/models/next_sgad/justification.rb', line 38

def days
  attendances.order(date: :asc).map(&:date)
end

#first_approveObject

gives first approval



18
19
20
# File 'app/models/next_sgad/justification.rb', line 18

def first_approve
  update(first_approval_status: 1)
end

#first_disapproveObject

gives first approval



28
29
30
# File 'app/models/next_sgad/justification.rb', line 28

def first_disapprove
  update(first_approval_status: 2)
end

#second_approveObject

gives second approval



23
24
25
# File 'app/models/next_sgad/justification.rb', line 23

def second_approve
  update(second_approval_status: 1)
end

#second_disapproveObject

gives second disapproval



33
34
35
# File 'app/models/next_sgad/justification.rb', line 33

def second_disapprove
  update(second_approval_status: 2)
end