Class: HrLite::ApprovalDelegation
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- HrLite::ApprovalDelegation
- Includes:
- Audited
- Defined in:
- app/models/hr_lite/approval_delegation.rb
Overview
"I am away until the 14th — Priya decides for me." Delegation does not move the approval; it lets somebody else answer it, and the row records who actually did.
Constant Summary
Constants included from Audited
HrLite::Audited::REDACTED, HrLite::Audited::SKIPPED_ATTRIBUTES
Class Method Summary collapse
-
.stand_ins_for(user_id, on: Date.current) ⇒ Object
Who may answer on
user's behalf today, including a chain of two — A delegates to B, B is also away and delegates to C.
Class Method Details
.stand_ins_for(user_id, on: Date.current) ⇒ Object
Who may answer on user's behalf today, including a chain of two —
A delegates to B, B is also away and delegates to C. Capped at two
hops: past that it is quicker to reassign the flow than to follow it.
20 21 22 23 24 |
# File 'app/models/hr_lite/approval_delegation.rb', line 20 def self.stand_ins_for(user_id, on: Date.current) first = live_on(on).where(from_user_id: user_id).pluck(:to_user_id) second = live_on(on).where(from_user_id: first).pluck(:to_user_id) (first + second - [ user_id ]).uniq end |