@@ -107,6 +107,8 @@ def not_catch_up
107107 end
108108
109109 def consent_deadline
110+ return nil if session . nil?
111+
110112 next_date = session . future_dates . first
111113
112114 close_consent_at =
@@ -117,6 +119,7 @@ def consent_deadline
117119
118120 def consent_link
119121 return nil if session . nil? || programmes . empty?
122+
120123 host +
121124 start_parent_interface_consent_forms_path (
122125 session ,
@@ -173,41 +176,41 @@ def location_name
173176 if vaccination_record
174177 vaccination_record_location ( vaccination_record )
175178 else
176- session . location . name
179+ session & .location & .name
177180 end
178181 end
179182
180183 def next_or_today_session_date
181- session . next_date ( include_today : true ) &.to_fs ( :short_day_of_week )
184+ session & .next_date ( include_today : true ) &.to_fs ( :short_day_of_week )
182185 end
183186
184187 def next_or_today_session_dates
185188 session
186- . today_or_future_dates
187- . map { it . to_fs ( :short_day_of_week ) }
188- . to_sentence
189+ & .today_or_future_dates
190+ & .map { it . to_fs ( :short_day_of_week ) }
191+ & .to_sentence
189192 end
190193
191194 def next_or_today_session_dates_or
192195 session
193- . today_or_future_dates
194- . map { it . to_fs ( :short_day_of_week ) }
195- . to_sentence ( last_word_connector : ", or " , two_words_connector : " or " )
196+ & .today_or_future_dates
197+ & .map { it . to_fs ( :short_day_of_week ) }
198+ & .to_sentence ( last_word_connector : ", or " , two_words_connector : " or " )
196199 end
197200
198201 def next_session_date
199- session . next_date ( include_today : false ) &.to_fs ( :short_day_of_week )
202+ session & .next_date ( include_today : false ) &.to_fs ( :short_day_of_week )
200203 end
201204
202205 def next_session_dates
203- session . future_dates . map { it . to_fs ( :short_day_of_week ) } . to_sentence
206+ session & .future_dates & .map { it . to_fs ( :short_day_of_week ) } & .to_sentence
204207 end
205208
206209 def next_session_dates_or
207210 session
208- . future_dates
209- . map { it . to_fs ( :short_day_of_week ) }
210- . to_sentence ( last_word_connector : ", or " , two_words_connector : " or " )
211+ & .future_dates
212+ & .map { it . to_fs ( :short_day_of_week ) }
213+ & .to_sentence ( last_word_connector : ", or " , two_words_connector : " or " )
211214 end
212215
213216 def outcome_administered
@@ -263,6 +266,8 @@ def show_additional_instructions
263266 end
264267
265268 def subsequent_session_dates_offered_message
269+ return nil if session . nil?
270+
266271 dates = session . future_dates . drop ( 1 )
267272 return "" if dates . empty?
268273
@@ -304,7 +309,10 @@ def talk_to_your_child_message
304309 ] . join ( "\n \n " )
305310 end
306311
307- delegate :privacy_notice_url , :privacy_policy_url , to : :team , prefix : true
312+ delegate :privacy_notice_url ,
313+ :privacy_policy_url ,
314+ to : :team ,
315+ prefix : true
308316
309317 def today_or_date_of_vaccination
310318 return if vaccination_record . nil?
0 commit comments