Class: Renalware::Pathology::Requests::GlobalRule::TransplantDateWithinWeeks

Inherits:
Renalware::Pathology::Requests::GlobalRule show all
Defined in:
app/models/renalware/pathology/requests/global_rule/transplant_date_within_weeks.rb

Constant Summary

Constants inherited from Renalware::Pathology::Requests::GlobalRule

PARAM_COMPARISON_OPERATORS

Instance Method Summary collapse

Instance Method Details

#observation_required_for_patient?(patient, date) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
# File 'app/models/renalware/pathology/requests/global_rule/transplant_date_within_weeks.rb', line 12

def observation_required_for_patient?(patient, date)
  most_recent_operation =
    Transplants::RecipientOperation.for_patient(patient).most_recent
  return false if most_recent_operation.blank?

  latest_date_possible = date - param_comparison_value.to_i.weeks

  most_recent_operation.performed_on > latest_date_possible
end

#to_sObject



22
23
24
# File 'app/models/renalware/pathology/requests/global_rule/transplant_date_within_weeks.rb', line 22

def to_s
  "transplant date within #{param_comparison_value} weeks ago"
end