From b16ed7188e0df7329da7c5d6c07ce16df2c0682d Mon Sep 17 00:00:00 2001 From: Mark Longair Date: Fri, 1 Nov 2013 18:14:27 +0000 Subject: Add a info_requests_visible_classified_count column to PublicBody This counts only those info requests that have prominence 'normal' (i.e. are not hidden) and are not 'awaiting_description' (i.e. that they have had some basic status classification). --- app/models/info_request.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index eba620f53..bb6a5eb1d 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -1190,6 +1190,10 @@ public self.public_body.info_requests_successful_count = InfoRequest.where( :public_body_id => self.public_body.id, :described_state => ['successful', 'partially_successful']).count + self.public_body.info_requests_visible_classified_count = InfoRequest.where( + :public_body_id => self.public_body_id, + :awaiting_description => false, + :prominence => 'normal').count self.public_body.without_revision do public_body.no_xapian_reindex = true public_body.save -- cgit v1.2.3