@@ -24,6 +24,8 @@ def status
2424 :given
2525 elsif status_should_be_refused?
2626 :refused
27+ elsif status_should_be_follow_up_requested?
28+ :follow_up_requested
2729 elsif status_should_be_conflicts?
2830 :conflicts
2931 elsif status_should_be_no_response?
@@ -84,7 +86,18 @@ def conflicting_disease_types?
8486 def status_should_be_refused?
8587 return false if vaccinated?
8688
87- latest_consents . any? && latest_consents . all? ( &:response_refused? )
89+ latest_consents . any? && latest_consents . all? ( &:hard_refusal? )
90+ end
91+
92+ def status_should_be_follow_up_requested?
93+ return false if vaccinated?
94+
95+ # Follow-up is the outcome when there are no outright refusals and at least
96+ # one consent has follow_up_requested — including the case where one parent
97+ # has given consent and another has asked for a follow-up discussion,
98+ # because that discussion could change the outcome to :given.
99+ consents_for_status . any? && consents_for_status . none? ( &:hard_refusal? ) &&
100+ consents_for_status . any? ( &:refusal_with_follow_up? )
88101 end
89102
90103 def status_should_be_conflicts?
@@ -93,10 +106,15 @@ def status_should_be_conflicts?
93106 consents_for_status =
94107 ( self_consents . any? ? self_consents : parental_consents )
95108
96- if consents_for_status . any? ( &:response_refused? ) &&
97- consents_for_status . any? ( &:response_given? )
98- return true
99- end
109+ has_given = consents_for_status . any? ( &:response_given? )
110+ has_hard_refusal = consents_for_status . any? ( &:hard_refusal? )
111+ has_follow_up = consents_for_status . any? ( &:refusal_with_follow_up? )
112+
113+ return true if has_given && has_hard_refusal
114+
115+ # hard refusal + follow_up is a conflict: even if the follow-up
116+ # resolves to given, the outstanding refusal remains unresolved
117+ return true if has_hard_refusal && has_follow_up
100118
101119 consents_for_status . any? && consents_for_status . all? ( &:response_given? ) &&
102120 ( agreed_vaccine_methods . blank? || conflicting_disease_types? )
0 commit comments