aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/request_controller.rb4
-rw-r--r--app/models/info_request_event.rb3
-rw-r--r--app/views/request/_correspondence.rhtml1
-rw-r--r--app/views/request/describe_state.rhtml4
-rw-r--r--app/views/request/show.rhtml4
-rw-r--r--todo.txt3
6 files changed, 9 insertions, 10 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index fb9a75cc2..4e40f0e7f 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: request_controller.rb,v 1.45 2008-02-06 12:20:37 francis Exp $
+# $Id: request_controller.rb,v 1.46 2008-02-07 15:11:16 francis Exp $
class RequestController < ApplicationController
@@ -19,6 +19,7 @@ class RequestController < ApplicationController
@events_needing_description = @info_request.events_needing_description
last_event = @events_needing_description[-1]
@last_info_request_event_id = last_event.nil? ? nil : last_event.id
+ @new_responses_count = @events_needing_description.select {|i| i.event_type == 'response'}.size
end
def list
@@ -95,6 +96,7 @@ class RequestController < ApplicationController
last_event = @events_needing_description[-1]
@last_info_request_event_id = last_event.nil? ? nil : last_event.id
@is_owning_user = !authenticated_user.nil? && authenticated_user.id == @info_request.user_id
+ @new_responses_count = @events_needing_description.select {|i| i.event_type == 'response'}.size
if @last_info_request_event_id.nil?
raise "mnoo " + @events_needing_description.size.to_s
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index 800acdf45..528d728a7 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -16,7 +16,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: info_request_event.rb,v 1.10 2008-02-06 09:41:44 francis Exp $
+# $Id: info_request_event.rb,v 1.11 2008-02-07 15:11:16 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
@@ -27,7 +27,6 @@ class InfoRequestEvent < ActiveRecord::Base
'sent',
'resent',
'followup_sent',
- 'followup_resent',
'edit_outgoing', # outgoing message edited in admin interface
'manual', # you did something in the db by hand
'response'
diff --git a/app/views/request/_correspondence.rhtml b/app/views/request/_correspondence.rhtml
index 1ff42c5e1..d283a1acb 100644
--- a/app/views/request/_correspondence.rhtml
+++ b/app/views/request/_correspondence.rhtml
@@ -1,6 +1,7 @@
<div id="correspondence">
<%
+
@last_email = nil
if !info_request_event.nil? && info_request_event.event_type == 'response'
incoming_message = IncomingMessage.find(info_request_event.params[:incoming_message_id])
diff --git a/app/views/request/describe_state.rhtml b/app/views/request/describe_state.rhtml
index 47ab3c232..1a2c98563 100644
--- a/app/views/request/describe_state.rhtml
+++ b/app/views/request/describe_state.rhtml
@@ -1,4 +1,4 @@
-<% @title = MySociety::Format.fancy_pluralize(@events_needing_description.size, 'New response', 'new responses') +
+<% @title = MySociety::Format.fancy_pluralize(@new_responses_count, 'New response', 'new responses') +
" to '" + h(@info_request.title) + "'" %>
<%= foi_error_messages_for :incoming_message, :outgoing_message %>
@@ -8,7 +8,7 @@
</div>
<div id="show_response_view">
- <h2><%=MySociety::Format.fancy_pluralize(@events_needing_description.size, 'New response', 'new responses') %>
+ <h2><%=MySociety::Format.fancy_pluralize(@new_responses_count, 'New response', 'new responses') %>
to your request '<%= request_link @info_request %>'</h2>
<% for info_request_event in @events_needing_description %>
diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml
index c438d7583..f10e36ccd 100644
--- a/app/views/request/show.rhtml
+++ b/app/views/request/show.rhtml
@@ -19,11 +19,11 @@
<% if @info_request.awaiting_description %>
<% if @is_owning_user %>
Please <strong>answer the question above</strong> so we know whether the
- <%= MySociety::Format.fancy_pluralize(@events_needing_description.size, 'recent response contains', 'recent responses contain') %> useful information.
+ <%= MySociety::Format.fancy_pluralize(@new_responses_count, 'recent response contains', 'recent responses contain') %> useful information.
<% else %>
This request has an <strong>unknown status</strong>. We're waiting for
<%= user_link(@info_request.user) %> to read
- <%= MySociety::Format.fancy_pluralize(@events_needing_description.size, 'a recent response', 'recent responses') %>
+ <%= MySociety::Format.fancy_pluralize(@new_responses_count, 'a recent response', 'recent responses') %>
and update the status.
<% end %>
<% elsif @status == 'waiting_response' %>
diff --git a/todo.txt b/todo.txt
index d16700f81..bf609f543 100644
--- a/todo.txt
+++ b/todo.txt
@@ -20,9 +20,6 @@ BAILII - relationship with law courts, robots.txt ?
Status of messages stuff
========================
-events_needing_description.size in views wrong
-check goes to describe URL from email
-
Add - response was made in private state
or maybe 'response refusing to publish for spurious reasons