File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -520,6 +520,7 @@ def delivery_site_matches_delivery_method
520520 def validate_patient_attendance
521521 return unless new_record?
522522 return unless session &.today?
523+ return unless session &.requires_registration?
523524 return if patient . blank?
524525
525526 attendance_record =
Original file line number Diff line number Diff line change 128128 it { should validate_length_of ( :notes ) . is_at_most ( 1000 ) . on ( :update ) }
129129 end
130130
131+ context "when registration is disabled for the session" do
132+ let ( :session ) do
133+ create (
134+ :session ,
135+ team :,
136+ programmes : [ programme ] ,
137+ requires_registration : false
138+ )
139+ end
140+
141+ let ( :patient ) { create ( :patient , session :) }
142+ let ( :attributes ) { valid_administered_attributes }
143+
144+ before { draft_vaccination_record . wizard_step = :confirm }
145+
146+ it "does not require an attendance record to record a vaccination" do
147+ expect ( draft_vaccination_record . save ( context : :update ) ) . to be ( true )
148+ expect ( draft_vaccination_record . errors [ :base ] ) . not_to include (
149+ "Child is marked as not attending this session. Mark them as attending to record a vaccination."
150+ )
151+ end
152+ end
153+
131154 context "when the patient is marked not attending" do
132155 let ( :attributes ) { valid_administered_attributes }
133156 let ( :patient ) { create ( :patient , session :) }
You can’t perform that action at this time.
0 commit comments