Class: NextSgad::Attendance
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ApplicationRecord
- NextSgad::Attendance
- Defined in:
- app/models/next_sgad/attendance.rb
Class Method Summary collapse
-
.all_absence ⇒ Object
get all attendances with state absence or late.
-
.with_justification ⇒ Object
get attendances with justification.
- .without_justification ⇒ Object
Instance Method Summary collapse
-
#has_justification? ⇒ Boolean
true if an attendace has justification.
- #justification ⇒ Object
Methods inherited from ApplicationRecord
#create_number, #create_number!
Class Method Details
.all_absence ⇒ Object
get all attendances with state absence or late
26 27 28 |
# File 'app/models/next_sgad/attendance.rb', line 26 def self.all_absence where(status: [-4,-3,-2,-1,1]) end |
.with_justification ⇒ Object
get attendances with justification
31 32 33 |
# File 'app/models/next_sgad/attendance.rb', line 31 def self.with_justification where(justification_status: [0,1,2]) end |
.without_justification ⇒ Object
35 36 37 |
# File 'app/models/next_sgad/attendance.rb', line 35 def self.without_justification where(status: [-4,-3,-2,-1,1]).where(justification_status: -1) end |
Instance Method Details
#has_justification? ⇒ Boolean
true if an attendace has justification
40 41 42 |
# File 'app/models/next_sgad/attendance.rb', line 40 def has_justification? pending? || approved? || disapproved? || in_progress? end |
#justification ⇒ Object
44 45 46 |
# File 'app/models/next_sgad/attendance.rb', line 44 def justification justifications.last end |