diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/help_controller.rb | 14 | ||||
-rw-r--r-- | app/controllers/request_controller.rb | 3 | ||||
-rw-r--r-- | app/models/info_request.rb | 70 | ||||
-rw-r--r-- | app/views/help/about.rhtml | 40 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 1 | ||||
-rw-r--r-- | app/views/request/show.rhtml | 8 |
6 files changed, 122 insertions, 14 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb new file mode 100644 index 000000000..8a58c1ade --- /dev/null +++ b/app/controllers/help_controller.rb @@ -0,0 +1,14 @@ +# app/controllers/help_controller.rb: +# Show information about one particular request. +# +# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. +# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# +# $Id: help_controller.rb,v 1.1 2008-01-09 15:35:40 francis Exp $ + +class HelpController < ApplicationController + + def about + end + +end diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index e665f690a..843446032 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.30 2008-01-04 16:15:40 francis Exp $ +# $Id: request_controller.rb,v 1.31 2008-01-09 15:35:40 francis Exp $ class RequestController < ApplicationController @@ -13,6 +13,7 @@ class RequestController < ApplicationController @correspondences = @info_request.incoming_messages + @info_request.info_request_events @correspondences.sort! { |a,b| a.sent_at <=> b.sent_at } @status = @info_request.calculate_status + @date_response_required_by = @info_request.date_response_required_by @collapse_quotes = params[:unfold] ? false : true end diff --git a/app/models/info_request.rb b/app/models/info_request.rb index e7f9831d6..d86614f1d 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -17,7 +17,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.24 2008-01-04 11:19:18 francis Exp $ +# $Id: info_request.rb,v 1.25 2008-01-09 15:35:40 francis Exp $ require 'digest/sha1' @@ -94,16 +94,12 @@ public end # See if response would be overdue - overdue = false - # XXX if a second outgoing message is really a new request, then this - # is no good - # We use the last_sent_at date for each outgoing message, as fair - # enough if the first email bounced or something and it got recent. - earliest_sent = self.outgoing_messages.map { |om| om.last_sent_at }.min - time_left = Time.now - earliest_sent - # XXX use working days - if time_left > 20.days + date_today = Time.now.strftime("%Y-%m-%d") + date_response = date_response_required_by.strftime("%Y-%m-%d") + if date_today > date_response overdue = true + else + overdue = false end # Return appropriate status string @@ -124,6 +120,60 @@ public end end + # Calculate date by which response is required by law. + # + # ... "working day” means any day other than a Saturday, a Sunday, Christmas + # Day, Good Friday or a day which is a bank holiday under the [1971 c. 80.] + # Banking and Financial Dealings Act 1971 in any part of the United Kingdom. + # + # Freedom of Information Act 2000 section 10 + # + # XXX how do we cope with case where extra info was required from the requester + # by the public body in order to fulfill the request, as per sections 1(3) and 10(6b) ? + def date_response_required_by + # We use the last_sent_at date for each outgoing message, as fair + # enough if the first email bounced or something and it got recent. + # XXX if a second outgoing message is really a new request, then this + # is no good. Likewise, a second outgoing message may contain + # clarifications asked for by the public body, and so reset things. + # Possibly just show 20 working days since the *last* message? Hmmm. + earliest_sent = self.outgoing_messages.map { |om| om.last_sent_at }.min + + days_passed = 0 + response_required_by = earliest_sent + while days_passed < 20 + response_required_by = response_required_by + 1.day + if response_required_by.wday == 0 || response_required_by.wday == 6 + # not working day, as weekend + elsif [ + # Union of holidays from these places: + # http://www.dti.gov.uk/employment/bank-public-holidays/ + # http://www.scotland.gov.uk/Publications/2005/01/bankholidays + + '2007-11-30', '2007-12-25', '2007-12-26', + + '2008-01-01', '2008-01-02', '2008-03-17', '2008-03-21', '2008-03-24', '2008-05-05', + '2008-05-26', '2008-07-14', '2008-08-04', '2008-08-25', '2008-12-01', '2008-12-25', '2008-12-26', + + '2009-01-01', '2009-01-02', '2009-03-17', '2009-04-10', '2009-04-13', '2009-05-04', + '2009-05-25', '2009-07-13', '2009-08-03', '2009-08-31', '2009-11-30', '2009-12-25', '2009-12-28', + + '2010-01-01', '2010-01-04', '2010-03-17', '2010-04-02', '2010-04-05', '2010-05-03', + '2010-05-31', '2010-07-12', '2010-08-02', '2010-08-30', '2010-11-30', '2010-12-27', '2010-12-28' + + + ].include?(response_required_by.strftime('%Y-%m-%d')) + # bank holiday + else + days_passed = days_passed + 1 + end + end + + # XXX and give until the end of that 20th working day + + return response_required_by + end + # Return array of unclassified responses def unclassified_responses return self.incoming_messages.select do |msg| diff --git a/app/views/help/about.rhtml b/app/views/help/about.rhtml new file mode 100644 index 000000000..371c4bc87 --- /dev/null +++ b/app/views/help/about.rhtml @@ -0,0 +1,40 @@ +<dl> + +<dt>What is GovernmentSpy for?</dt> + +<dd>To help you find out inside information about what the UK government +is doing.</dd> + +<dt>How does the site work?</dt> + +<dd>You choose the public body that you would like information from, then +write a brief note describing what you want to know. We then send your request +to the public body. Any response they make is automatically published on the +website for you and anyone else to find and read. +</dd> + +<dt>Why would I bother to do this?</dt> + +<dd>You pay taxes, and then Government does things with the money. Some it does +badly, some it does well. The more we find out about how Government works, the +better able we are to make suggestions to improve the things that are done badly, +and to celebrate the things which are done well. This affects a whole range +of issues important to your life, from healthcare through to national defense. +</dd> + +</dl> + +<h1>Making requests</h1> +<dl> + +<dt id="quickly_response">How quickly will I get a response?</dt> + +<dd>By law public bodies must respond within 20 days, excluding weekends and +any UK bank holidays. The date that the response is due by is shown on the +page for your request. If you have agreed to pay a fee, or if you had to give +follow up information to clarify your request, the legal date will be slightl +data. +</dd> + +</dl> + diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index ef468c522..bf7431e5e 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -20,6 +20,7 @@ <li><%=link_to "My Requests", user_url(@user) %></li> <% else %> <% end %> + <li><%= link_to "About", about_url %></li> <!-- <li><a href="/about">About</a></li> --> </ul> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index 99ba55d11..dd0dbd63b 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -11,11 +11,13 @@ <p id="request_status"> <% if @status == 'awaiting' %> - Currently <strong>waiting for a response</strong> from <%= public_body_link(@info_request.public_body) %> + Currently <strong>waiting for a response</strong> from <%= public_body_link(@info_request.public_body) %>. + Response must be made by <strong><%= simple_date(@date_response_required_by) %></strong>. <% elsif @status == 'overdue' %> 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. + public_body_link(@info_request.public_body) %>. The + <%= link_to "response was due", about_url %></li> + on <strong><%= simple_date(@date_response_required_by) %></strong>. <% elsif @status == 'information' %> The request was at least partly <strong>successful</strong>. <% elsif @status == 'none' %> |