Class: Renalware::Problems::Problem

Inherits:
ApplicationRecord show all
Includes:
Accountable, Renalware::PatientScope
Defined in:
app/models/renalware/problems/problem.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Accountable

#first_or_create_by!, #save_by, #save_by!, #update_by

Class Method Details

.archivedObject



36
37
38
# File 'app/models/renalware/problems/problem.rb', line 36

def self.archived
  only_deleted.with_notes
end

.currentObject



32
33
34
# File 'app/models/renalware/problems/problem.rb', line 32

def self.current
  all.with_notes
end

.reject_if_procObject



60
61
62
# File 'app/models/renalware/problems/problem.rb', line 60

def self.reject_if_proc
  proc { |attrs| attrs[:description].blank? }
end

.with_archivedObject



28
29
30
# File 'app/models/renalware/problems/problem.rb', line 28

def self.with_archived
  with_deleted
end

Instance Method Details

#archived?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'app/models/renalware/problems/problem.rb', line 40

def archived?
  deleted?
end

#archived_atObject



44
45
46
# File 'app/models/renalware/problems/problem.rb', line 44

def archived_at
  deleted_at
end

#archived_onObject



48
49
50
# File 'app/models/renalware/problems/problem.rb', line 48

def archived_on
  deleted_at.to_date
end

#created_onObject



52
53
54
# File 'app/models/renalware/problems/problem.rb', line 52

def created_on
  created_at.to_date
end

#formattedObject



68
69
70
# File 'app/models/renalware/problems/problem.rb', line 68

def formatted
  "#{full_description}, #{date}"
end

#full_descriptionObject



64
65
66
# File 'app/models/renalware/problems/problem.rb', line 64

def full_description
  description
end

#updated_onObject



56
57
58
# File 'app/models/renalware/problems/problem.rb', line 56

def updated_on
  updated_at.to_date
end