aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-05-06 17:23:15 +0100
committerGareth Rees <gareth@mysociety.org>2015-05-12 17:34:34 +0100
commit0b2b8f0c280777fc531ddfafc9df6dbab645ec49 (patch)
treeba37aa3424cb300ce7a48b2f9a637448153ee769 /app/models/info_request.rb
parent5280034f83a4e7f000945ee45bc96a659dcd4619 (diff)
Use database attributes to find public_response_events
user system total real old 1.070000 0.280000 1.350000 ( 1.657773) new 0.560000 0.120000 0.680000 ( 0.743485)
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index b742dcc03..3ce89be3b 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -777,7 +777,14 @@ public
end
def public_response_events
- self.info_request_events.select{|e| e.response? && e.incoming_message.all_can_view? }
+ condition = <<-SQL
+ info_request_events.event_type = ?
+ AND incoming_messages.prominence = ?
+ SQL
+
+ info_request_events.
+ joins(:incoming_message).
+ where(condition, 'response', 'normal')
end
# The last public response is the default one people might want to reply to