diff --git a/app/models/form/eligibility_check.rb b/app/models/form/eligibility_check.rb index e5139d8f..d50965db 100644 --- a/app/models/form/eligibility_check.rb +++ b/app/models/form/eligibility_check.rb @@ -40,6 +40,8 @@ def failure_reason end def date_of_entry_eligible?(date_of_entry, start_date) + return false unless date_of_entry && start_date + date_of_entry >= start_date - 3.months end diff --git a/app/queries/forms_funnel_query.rb b/app/queries/forms_funnel_query.rb index cd52c211..0b227a50 100644 --- a/app/queries/forms_funnel_query.rb +++ b/app/queries/forms_funnel_query.rb @@ -63,7 +63,7 @@ def entry_date_step_query(required_field) form_dates = date_of_entries.each_with_object([]) do |(id, date_of_entry), list| entry = start_dates.detect { |(sid, _)| sid == id } - list << [date_of_entry.to_date, entry.last.to_date] + list << [date_of_entry.to_date, entry&.last&.to_date] list end