Class: Observ::ReviewItem
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Observ::ReviewItem
- Defined in:
- app/models/observ/review_item.rb
Instance Method Summary collapse
- #complete!(by: nil) ⇒ Object
- #priority_badge_class ⇒ Object
- #reason_display ⇒ Object
- #reviewable_type_display ⇒ Object
- #skip!(by: nil) ⇒ Object
- #start_review! ⇒ Object
Instance Method Details
#complete!(by: nil) ⇒ Object
20 21 22 |
# File 'app/models/observ/review_item.rb', line 20 def complete!(by: nil) update!(status: :completed, completed_at: Time.current, completed_by: by) end |
#priority_badge_class ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/models/observ/review_item.rb', line 32 def priority_badge_class case priority when "critical" then "observ-badge--danger" when "high" then "observ-badge--warning" else "observ-badge--secondary" end end |
#reason_display ⇒ Object
40 41 42 |
# File 'app/models/observ/review_item.rb', line 40 def reason_display reason&.titleize&.gsub("_", " ") || "Manual" end |
#reviewable_type_display ⇒ Object
44 45 46 |
# File 'app/models/observ/review_item.rb', line 44 def reviewable_type_display reviewable_type.demodulize end |
#skip!(by: nil) ⇒ Object
24 25 26 |
# File 'app/models/observ/review_item.rb', line 24 def skip!(by: nil) update!(status: :skipped, completed_at: Time.current, completed_by: by) end |
#start_review! ⇒ Object
28 29 30 |
# File 'app/models/observ/review_item.rb', line 28 def start_review! update!(status: :in_progress) if pending? end |