Class: NextSgad::Justification
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ApplicationRecord
- NextSgad::Justification
- Defined in:
- app/models/next_sgad/justification.rb
Instance Attribute Summary collapse
-
#dates ⇒ Object
disapproved if both disapproved approved if both approved pending if both pending in_progress if not first, second nor third.
Instance Method Summary collapse
-
#days ⇒ Object
Return an arrays of dates associated to this justification.
-
#first_approve ⇒ Object
gives first approval.
-
#first_disapprove ⇒ Object
gives first approval.
-
#second_approve ⇒ Object
gives second approval.
-
#second_disapprove ⇒ Object
gives second disapproval.
Methods inherited from ApplicationRecord
#create_number, #create_number!
Instance Attribute Details
#dates ⇒ Object
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
#days ⇒ Object
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_approve ⇒ Object
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_disapprove ⇒ Object
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_approve ⇒ Object
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_disapprove ⇒ Object
gives second disapproval
33 34 35 |
# File 'app/models/next_sgad/justification.rb', line 33 def second_disapprove update(second_approval_status: 2) end |