diff options
-rw-r--r-- | app/controllers/request_controller.rb | 21 | ||||
-rw-r--r-- | app/models/info_request.rb | 28 | ||||
-rw-r--r-- | app/models/rejection_reason.rb | 50 | ||||
-rw-r--r-- | app/views/request/classify.rhtml | 66 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 8 | ||||
-rw-r--r-- | db/schema.rb | 9 | ||||
-rw-r--r-- | todo.txt | 4 |
7 files changed, 48 insertions, 138 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 6bfee315e..5ca065bd7 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.18 2007-11-22 15:22:35 francis Exp $ +# $Id: request_controller.rb,v 1.19 2007-11-23 10:57:24 francis Exp $ class RequestController < ApplicationController @@ -63,18 +63,27 @@ class RequestController < ApplicationController @incoming_message = IncomingMessage.find(params[:outgoing_message_id]) @info_request = @incoming_message.info_request - if authenticated_as_user?(@info_request.user, + if not authenticated_as_user?(@info_request.user, :web => "To view and classify the response to this FOI request", :email => "Then you can classify the FOI response you have got from " + @info_request.public_body.name + ".", :email_subject => "Classify a response from " + @info_request.public_body.name + " to your FOI request" ) - @correspondences = @info_request.outgoing_messages + @info_request.incoming_messages - @correspondences.sort! { |a,b| a.sent_at <=> b.sent_at } - @status = @info_request.calculate_status - else + return # do nothing - as "authenticated?" has done the redirect to signin page for us end + if params[:incoming_message] + contains_information = (params[:incoming_message][:contains_information] == 'true' ? true : false) + @incoming_message.contains_information = contains_information + @incoming_message.user_classified = true + @incoming_message.save + flash[:notice] = "Thank you for classifying the response." + redirect_to show_request_url(:id => @info_request) + end + + @correspondences = @info_request.outgoing_messages + @info_request.incoming_messages + @correspondences.sort! { |a,b| a.sent_at <=> b.sent_at } + @status = @info_request.calculate_status end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index eb02587a8..72500d9e0 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.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: info_request.rb,v 1.13 2007-11-14 01:01:39 francis Exp $ +# $Id: info_request.rb,v 1.14 2007-11-23 10:57:24 francis Exp $ require 'digest/sha1' @@ -61,13 +61,14 @@ class InfoRequest < ActiveRecord::Base def calculate_status # Extract aggregate information for any incoming messages all together contains_information = false - rejection_reasons = [] + missing_classification = false self.incoming_messages.each do |msg| if msg.user_classified if msg.contains_information contains_information = true end - rejection_reasons += msg.rejection_reasons + else + missing_classification = true end end @@ -90,26 +91,15 @@ class InfoRequest < ActiveRecord::Base return "awaiting" end end - if contains_information and rejection_reasons.size > 0 - return "information_and_rejection" + if missing_classification + return "unknown" end - if contains_information and rejection_reasons.size == 0 + if contains_information return "information" + else + return "none" end - if rejection_reasons.size > 0 - return "rejection" - end - return "unknown" end - # - Awaiting response (in 20 working day limit) - # - Overdue a response (over 20 working day limit) - # - # - Has a response but not sure what to think of it - # - Received a positive response - # - Received a partly positive response w/ rejection reasons - # - Received an entirely negative response w/ rejection reasons - # - # - Have sent a follow up end diff --git a/app/models/rejection_reason.rb b/app/models/rejection_reason.rb deleted file mode 100644 index 347aeff1f..000000000 --- a/app/models/rejection_reason.rb +++ /dev/null @@ -1,50 +0,0 @@ -# app/models/rejection_reasons.rb -# Give one reason under the Freedom of Information Act 2000 as to why -# a particular incoming message was rejected. An incoming message can -# have multiple such reasons. -# -# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ -# -# $Id: rejection_reason.rb,v 1.2 2007-11-22 15:22:36 francis Exp $ - -class RejectionReason < ActiveRecord::Base - belongs_to :incoming_message - validates_presence_of :incoming_message_id - - @@all_reasons = [ - { "section21" => "Information accessible to applicant by other means" }, - { "section22" => "Information intended for future publication" }, - { "section23" => "Information supplied by, or relating to, bodies dealing with security matters" }, - { "section24" => "National security" }, - { "section25" => "Certificates under ss. 23 and 24: supplementary provisions" }, - { "section26" => "Defence" }, - { "section27" => "International relations" }, - { "section28" => "Relations within the United Kingdom" }, - { "section29" => "The economy" }, - { "section30" => "Investigations and proceedings conducted by public authorities" }, - { "section31" => "Law enforcement" }, - { "section32" => "Court records, etc" }, - { "section33" => "Audit functions" }, - { "section34" => "Parliamentary privilege" }, - { "section35" => "Formulation of government policy, etc" }, - { "section36" => "Prejudice to effective conduct of public affairs" }, - { "section37" => "Communications with Her Majesty, etc. and honours" }, - { "section38" => "Health and safety" }, - { "section39" => "Environmental information" }, - { "section40" => "Personal information" }, - { "section41" => "Information provided in confidence" }, - { "section42" => "Legal professional privilege" }, - { "section43" => "Commercial interests" }, - { "section44" => "Prohibitions on disclosure" } - ] - @@all_reasons_array = @@all_reasons.map{ |h| h.keys }.flatten - @@all_reasons_hash = {} - @@all_reasons.each { |h| @@all_reasons_hash.merge!(h) } - - cattr_accessor :all_reasons_array - cattr_accessor :all_reasons_hash - -# validates_inclusion_of :reason, :in => RejectionReason.all_reasons_array -end - diff --git a/app/views/request/classify.rhtml b/app/views/request/classify.rhtml index 07d68b703..c6ce42d14 100644 --- a/app/views/request/classify.rhtml +++ b/app/views/request/classify.rhtml @@ -1,6 +1,6 @@ <% @title = "Classify FOI response" %> -<%= foi_error_messages_for :rejection_reason %> +<%= foi_error_messages_for :incoming_message %> <div id="classify_view"> <h2>New response to your request '<%= request_link @info_request %>'</h2> @@ -8,56 +8,22 @@ <%= render :partial => 'correspondence', :locals => { :correspondence => @incoming_message } %> </div> -<div id="classify_action"> -<% form_for(:rejection_reason, @info_request ) do |f| %> - <h2>Classify the response</h2> - <p>Does this response contain any of the information that you requested?</p> - <% fields_for :incoming_message do |o| %> - <p> - <%= radio_button "incoming_message", "contains_information", "true" %> - <label for="incoming_message_contains_information_true">Yes, this response contains some or all of the information that I requested</label> - <br> - <%= radio_button "incoming_message", "contains_information", "false" %> - <label for="incoming_message_contains_information_false">No, this response does not contain anything useful</label> - </p> - <% end %> - - - <h2>Rejection reasons</h2> - - <p>Does this response give any - <a href="http://www.opsi.gov.uk/Acts/acts2000/plain/ukpga_20000036_en#pt2">reasons under the FOI Act 2000</a> - for rejecting your request, or part of your request?</p> +<% if not @incoming_message.user_classified %> + <div id="classify_action"> + <% form_for(:incoming_message, @info_request ) do |f| %> + <h2>Got what you wanted?</h2> + <p>Does this response contain any of the information that you requested?</p> + <p> + <%= radio_button "incoming_message", "contains_information", "true" %> + <label for="incoming_message_contains_information_true">Yes, this response contains some or all of the information that I requested.</label> + <br> + <%= radio_button "incoming_message", "contains_information", "false" %> + <label for="incoming_message_contains_information_false">No, this response does not contain any of the information.</label> + </p> + + <%= submit_tag "Update" %> - <p> - <%= radio_button "dummy", "reasons_given", "false" %> - <label for="dummy_reasons_given_false">No reasons for rejection under sections of an Act are given</label> - <br> - <%= radio_button "dummy", "reasons_given", "true" %> - <label for="dummy_reasons_given_true">Yes, they have given reasons for rejection</label> - </p> - - <p>If yes, choose all the reasons given for rejection.</p> - - <p> - <% for code_name in RejectionReason.all_reasons_array %> - <% human_name = RejectionReason.all_reasons_hash[code_name] %> - <%= check_box "reason", code_name %> - <label for="reason_<%= code_name %>"> - <%= - code_name =~ /section(\d+)/ - if not $1.nil? - "Section " + $1 + "." - end - %> - <%= human_name %> - </label> - <br> <% end %> - </p> - - <%= submit_tag "Update" %> - + <div> <% end %> -<div> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 64c9492cd..3b5a5c2bf 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -15,12 +15,10 @@ Currently <strong>waiting for a response</strong> from <%= public_body_link(@inf Currently <strong>overdue a response</strong> from <%= public_body_link(@info_request.public_body) %>. Under section blah of the Freedom of Information Act 2000 responses must be made within 20 working days. -<% elsif @status == 'information_and_rejection' %> -The request was <strong>partly successful, partly rejected</strong> <% elsif @status == 'information' %> -The request was <strong>successful</strong> -<% elsif @status == 'rejection' %> -The request was <strong>rejected</strong> +The request was at least partly <strong>successful</strong>. +<% elsif @status == 'none' %> +The request is <strong>not (yet) successful</strong>. <% elsif @status == 'unknown' %> <strong>Response received</strong>, but <%= user_link(@info_request.user) %> has not yet reported if it was successful or a rejection. diff --git a/db/schema.rb b/db/schema.rb index 188c180f1..8c5fb8ef6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,7 +2,7 @@ # migrations feature of ActiveRecord to incrementally modify your database, and # then regenerate this schema definition. -ActiveRecord::Schema.define(:version => 18) do +ActiveRecord::Schema.define(:version => 20) do create_table "incoming_messages", :force => true do |t| t.column "info_request_id", :integer @@ -66,13 +66,6 @@ ActiveRecord::Schema.define(:version => 18) do t.column "last_edit_comment", :string end - create_table "rejection_reasons", :force => true do |t| - t.column "incoming_message_id", :integer - t.column "reason", :string - t.column "created_at", :datetime - t.column "updated_at", :datetime - end - create_table "sessions", :force => true do |t| t.column "session_id", :string t.column "data", :text @@ -13,6 +13,8 @@ Next Check confirmed everywhere in password check etc. +Rename classify to /request/single_response or something? + Send email to requestor telling them new information has come in Let them send follow-ups Do something after 20 working days if you get no response @@ -117,6 +119,8 @@ Maybe prepend letter for them with "this is FOI request blah" boilerplate? Forgotten password link +Link to source code + Sources of public bodies ======================== |