Class: HrLite::Appraisal
Overview
Individual performance review. Drafted and edited by leadership,
invisible to the employee until shared; sharing locks it permanently —
a shared review is a record, corrections go in the next appraisal.
A promotion outcome records a DesignationChange at share time.
Constant Summary
collapse
- OUTCOMES =
%w[none increment promotion].freeze
- STATUSES =
%w[draft shared].freeze
Constants included
from Audited
HrLite::Audited::REDACTED, HrLite::Audited::SKIPPED_ATTRIBUTES
Instance Method Summary
collapse
Instance Method Details
#draft? ⇒ Boolean
29
|
# File 'app/models/hr_lite/appraisal.rb', line 29
def draft? = status == "draft"
|
#period_label ⇒ Object
51
52
53
|
# File 'app/models/hr_lite/appraisal.rb', line 51
def period_label
"#{period_start.strftime('%b %Y')} – #{period_end.strftime('%b %Y')}"
end
|
#share!(actor:) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/models/hr_lite/appraisal.rb', line 32
def share!(actor:)
raise ActiveRecord::RecordInvalid.new(self), "already shared" unless draft?
transaction do
update!(status: "shared", shared_at: Time.current)
record_promotion!(actor) if outcome == "promotion"
end
Notifications.publish(
"appraisal.shared",
title: "Your appraisal for #{period_label} has been shared",
body: rating ? "Rating: #{rating}/5" : nil,
path: "/appraisals/#{id}",
bell_to: [ user ],
email_to: [ user ]
)
true
end
|
#shared? ⇒ Boolean
30
|
# File 'app/models/hr_lite/appraisal.rb', line 30
def shared? = status == "shared"
|