Skip to content

Commit

Permalink
Rename Patient#{ => draft}_vaccination_records_for_session for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
benilovj committed Mar 19, 2024
1 parent e17275c commit e25bcfd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/controllers/patient_sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def set_patient

def set_draft_vaccination_record
@draft_vaccination_record =
@patient.vaccination_records_for_session(@session).find_or_initialize_by(
recorded_at: nil
)
@patient.draft_vaccination_records_for_session(
@session
).find_or_initialize_by(recorded_at: nil)
end

def set_route
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/vaccinations/batches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def set_batches

def set_draft_vaccination_record
@draft_vaccination_record =
@patient.vaccination_records_for_session(@session).find_by(
@patient.draft_vaccination_records_for_session(@session).find_by(
recorded_at: nil
)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/vaccinations/delivery_site_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def set_batches

def set_draft_vaccination_record
@draft_vaccination_record =
@patient.vaccination_records_for_session(@session).find_by(
@patient.draft_vaccination_records_for_session(@session).find_by(
recorded_at: nil
)

Expand Down
10 changes: 5 additions & 5 deletions app/controllers/vaccinations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def index
end

def new
if @patient.vaccination_records_for_session(@session).any?
if @patient.draft_vaccination_records_for_session(@session).any?
raise UnprocessableEntity
end
@draft_vaccination_record =
@patient.vaccination_records_for_session(@session).new
@patient.draft_vaccination_records_for_session(@session).new
end

def edit_reason
Expand Down Expand Up @@ -206,9 +206,9 @@ def set_patient_sessions

def set_draft_vaccination_record
@draft_vaccination_record =
@patient.vaccination_records_for_session(@session).find_or_initialize_by(
recorded_at: nil
)
@patient.draft_vaccination_records_for_session(
@session
).find_or_initialize_by(recorded_at: nil)
end

def set_draft_vaccination_record!
Expand Down
2 changes: 1 addition & 1 deletion app/models/patient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def as_json(options = {})
super.merge("full_name" => full_name, "age" => age)
end

def vaccination_records_for_session(session)
def draft_vaccination_records_for_session(session)
patient_sessions
.find_by_session_id(session.id)
.vaccination_records
Expand Down

0 comments on commit e25bcfd

Please sign in to comment.