File tree Expand file tree Collapse file tree
spec/lib/status_generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -332,24 +332,14 @@ def sessions
332332 @sessions ||=
333333 patient_locations
334334 . reject { it . location . generic_clinic? }
335- . flat_map { sessions_for ( it ) }
336- . uniq
337- end
338-
339- def sessions_for ( patient_location )
340- patient_location
341- . location
342- . team_locations
343- . select { it . academic_year == academic_year }
344- . flat_map ( &:sessions )
345- . select { it . programme_types . include? ( programme_type ) }
346- . select { session_in_patient_location_date_range? ( it , patient_location ) }
347- . reject ( &:completed? )
348- end
349-
350- def session_in_patient_location_date_range? ( session , patient_location )
351- return true if session . dates . empty?
352-
353- session . dates . any? { |date | date . in? ( patient_location . date_range ) }
335+ . flat_map do |patient_location |
336+ patient_location
337+ . location
338+ . team_locations
339+ . select { it . academic_year == academic_year }
340+ . flat_map ( &:sessions )
341+ . select { it . programme_types . include? ( programme_type ) }
342+ . reject ( &:completed? )
343+ end
354344 end
355345end
Original file line number Diff line number Diff line change 451451 its ( :status ) { should be ( :needs_consent_request_scheduled ) }
452452 end
453453
454- context "when the patient moved from a school to home educated" do
455- let ( :send_consent_requests_at ) { Date . tomorrow }
456- let ( :school_move ) do
457- create (
458- :school_move ,
459- :to_home_educated ,
460- patient :,
461- team : session . team ,
462- academic_year : AcademicYear . current
463- )
464- end
465-
466- before do
467- ConsentNotification . delete_all
468- school_move . confirm!
469- end
470-
471- its ( :status ) { should be ( :needs_consent_request_not_scheduled ) }
472- end
473-
474454 context "when a consent requests are not scheduled to go out in the future" do
475455 let ( :send_consent_requests_at ) { nil }
476456
You can’t perform that action at this time.
0 commit comments