Sha256: 36e45256f58b3dfa8295638c6bea01ba04672cb4d32d6c66a46bf67f49b64c34
Contents?: true
Size: 793 Bytes
Versions: 103
Compression:
Stored size: 793 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/letters" module Renalware module Letters class ReviseLetter include Wisper::Publisher include LetterPathology def self.build new end def call(patient, letter_id, params = {}) letter = patient.letters.pending.find(letter_id) Letter.transaction do # See e.g. Letter::Draft.revise letter.revise(params) if letter.changes.key?(:pathology_timestamp) letter.pathology_snapshot = build_pathology_snapshot(patient) end letter.save! end broadcast(:revise_letter_successful, letter) rescue ActiveRecord::RecordInvalid broadcast(:revise_letter_failed, letter) end end end end
Version data entries
103 entries across 103 versions & 1 rubygems