diff --git a/app/models/scheme.rb b/app/models/scheme.rb index 7ae492c9f..2224ef0e2 100644 --- a/app/models/scheme.rb +++ b/app/models/scheme.rb @@ -296,13 +296,13 @@ class Scheme < ApplicationRecord end def has_active_locations? - active? && locations.active.exists? + locations.active_status.exists? end def has_active_locations_on_date?(date) return false unless date - locations.any? { |location| date && location.active_on_date?(date) } + locations.any? { |location| location.active_on_date?(date) } end def reactivating_soon? diff --git a/app/views/schemes/_scheme_list.html.erb b/app/views/schemes/_scheme_list.html.erb index bb80c6bc1..967295236 100644 --- a/app/views/schemes/_scheme_list.html.erb +++ b/app/views/schemes/_scheme_list.html.erb @@ -28,7 +28,7 @@ <% row.with_cell(text: scheme.locations.visible&.count) %> <% row.with_cell do %> <%= status_tag_from_resource(scheme) %> - <% unless scheme.has_active_locations? %> + <% if scheme.active? && !scheme.has_active_locations? %> <%= content_tag(:div, "No currently active locations", class: "app-!-colour-muted", style: "margin-top: 10px") %> <% end %> <% end %> diff --git a/app/views/schemes/show.html.erb b/app/views/schemes/show.html.erb index ab005e18d..6cefa5847 100644 --- a/app/views/schemes/show.html.erb +++ b/app/views/schemes/show.html.erb @@ -26,7 +26,7 @@