Class: Renalware::Virology::Vaccination::Document

Inherits:
Document::Embedded
  • Object
show all
Defined in:
app/models/renalware/virology/vaccination.rb

Instance Method Summary collapse

Instance Method Details

#to_sObject



24
25
26
# File 'app/models/renalware/virology/vaccination.rb', line 24

def to_s
  [type_name, drug].reject(&:blank?).join(" - ")
end

#type_nameObject

Try and find the proper name for the vaccination type - we only store the vaccination type code in the jsonb document. If no match found just display the code eg ‘hbv_booster’. The Type mighjt have been deleted (has a deleted_at date) but we still want to display the actual name depite this, we include deleted rows when searching.



32
33
34
# File 'app/models/renalware/virology/vaccination.rb', line 32

def type_name
  VaccinationType.with_deleted.find_by(code: type)&.name || type
end