diff --git a/app/models/application_form.rb b/app/models/application_form.rb index 80bd8a486e..e7d79622ec 100644 --- a/app/models/application_form.rb +++ b/app/models/application_form.rb @@ -198,12 +198,16 @@ class ApplicationForm < ApplicationRecord scope :active, -> do - assessable - .or(awarded_pending_checks) - .or(potential_duplicate_in_dqt) - .or(awarded.where("awarded_at >= ?", 90.days.ago)) - .or(declined.where("declined_at >= ?", 90.days.ago)) - .or(withdrawn.where("withdrawn_at >= ?", 90.days.ago)) + joins(region: :country) + .where.not(countries: { code: "ZW" }) + .merge( + assessable + .or(awarded_pending_checks) + .or(potential_duplicate_in_dqt) + .or(awarded.where("awarded_at >= ?", 90.days.ago)) + .or(declined.where("declined_at >= ?", 90.days.ago)) + .or(withdrawn.where("withdrawn_at >= ?", 90.days.ago)), + ) end scope :destroyable, diff --git a/spec/system/assessor_interface/listing_application_forms_spec.rb b/spec/system/assessor_interface/listing_application_forms_spec.rb index ec096abb64..b8d8d61f52 100644 --- a/spec/system/assessor_interface/listing_application_forms_spec.rb +++ b/spec/system/assessor_interface/listing_application_forms_spec.rb @@ -65,6 +65,7 @@ def application_forms 25, :with_personal_information, :submitted, + region: create(:region, :in_country, country_code: "FR"), ).sort_by(&:submitted_at) end end