Class: Renalware::Problems::Problem

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sortable

#set_position

Methods included from Accountable

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

Class Method Details

.archivedObject



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

def self.archived
  only_deleted.with_notes
end

.currentObject



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

def self.current
  all.with_notes
end

.reject_if_procObject



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

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

.with_archivedObject



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

def self.with_archived
  with_deleted
end

Instance Method Details

#archived?Boolean

Returns:

  • (Boolean)


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

def archived?
  deleted?
end

#archived_atObject



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

def archived_at
  deleted_at
end

#archived_onObject



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

def archived_on
  deleted_at.to_date
end

#created_onObject



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

def created_on
  created_at.to_date
end

#formattedObject



73
74
75
# File 'app/models/renalware/problems/problem.rb', line 73

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

#full_descriptionObject



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

def full_description
  description
end

#updated_onObject



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

def updated_on
  updated_at.to_date
end