aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2013-03-01 15:12:00 +1100
committerMatthew Landauer <matthew@openaustralia.org>2013-03-02 14:49:13 +1100
commit450c8e766c943cd212d706ae53768f2bae563c67 (patch)
tree5248feb4931bde5b8edf38584dabafe883251fd7 /app/models/info_request.rb
parent3291fe2a287f09d2a1bc88ee0f5617cece3b3ee7 (diff)
Extract method
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 88770c684..4951ea3b8 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -729,14 +729,13 @@ public
get_last_response_event.incoming_message if get_last_response_event
end
+ def outgoing_events
+ info_request_events.select{|e| [ 'sent', 'followup_sent' ].include?(e.event_type) }
+ end
+
# The last outgoing message
def get_last_outgoing_event
- for e in self.info_request_events.reverse
- if [ 'sent', 'followup_sent' ].include?(e.event_type)
- return e
- end
- end
- return nil
+ outgoing_events.last
end
# Text from the the initial request, for use in summary display