aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/holiday_controller.rb4
-rw-r--r--app/models/holiday.rb4
-rw-r--r--app/models/info_request.rb10
-rw-r--r--spec/controllers/user_controller_spec.rb2
-rw-r--r--spec/models/holiday_spec.rb4
-rw-r--r--todo.txt7
6 files changed, 19 insertions, 12 deletions
diff --git a/app/controllers/holiday_controller.rb b/app/controllers/holiday_controller.rb
index 215d6b5b7..916ff54c8 100644
--- a/app/controllers/holiday_controller.rb
+++ b/app/controllers/holiday_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: holiday_controller.rb,v 1.1 2009-03-16 15:55:03 tony Exp $
+# $Id: holiday_controller.rb,v 1.2 2009-10-26 17:52:39 francis Exp $
class HolidayController < ApplicationController
@@ -14,7 +14,7 @@ class HolidayController < ApplicationController
def due_date
if params[:holiday]
@request_date = Date.strptime(params[:holiday]) or raise "Invalid date"
- @due_date = Holiday.due_date_from(@request_date)
+ @due_date = Holiday.due_date_from(@request_date, 20)
@skipped = Holiday.all(
:conditions => [ 'day >= ? AND day <= ?',
@request_date.strftime("%F"), @due_date.strftime("%F")
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index 422ddf291..b3a41dd01 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -21,13 +21,13 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: holiday.rb,v 1.9 2009-10-02 22:56:35 francis Exp $
+# $Id: holiday.rb,v 1.10 2009-10-26 17:52:39 francis Exp $
class Holiday < ActiveRecord::Base
# Calculate the date on which a request made on a given date falls due.
# i.e. it is due by the end of that day.
- def Holiday.due_date_from(start_date, working_days = 20)
+ def Holiday.due_date_from(start_date, working_days)
# convert date/times into dates
start_date = start_date.to_date
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index ea9cba679..a32aff1fb 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -24,7 +24,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.216 2009-10-20 10:45:51 francis Exp $
+# $Id: info_request.rb,v 1.217 2009-10-26 17:52:39 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
@@ -470,11 +470,11 @@ public
# waiting_classification
# waiting_response_overdue
def calculate_status
- return 'waiting_classification' if awaiting_description
- return described_state unless described_state == "waiting_response"
+ return 'waiting_classification' if self.awaiting_description
+ return described_state unless self.described_state == "waiting_response"
# Compare by date, so only overdue on next day, not if 1 second late
return 'waiting_response_overdue' if
- Time.now.strftime("%Y-%m-%d") > date_response_required_by.strftime("%Y-%m-%d")
+ Time.now.strftime("%Y-%m-%d") > self.date_response_required_by.strftime("%Y-%m-%d")
return 'waiting_response'
end
@@ -562,7 +562,7 @@ public
# things, e.g. fees, not properly covered.
def date_response_required_by
last_sent = last_event_forming_initial_request
- return Holiday.due_date_from(last_sent.outgoing_message.last_sent_at)
+ return Holiday.due_date_from(last_sent.outgoing_message.last_sent_at, 20)
end
# Are we more than 20 working days overdue?
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 6dc971bd6..f6f3c16ca 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
describe UserController, "when showing a user" do
integrate_views
- fixtures :users, :outgoing_messages, :incoming_messages, :raw_emails, :info_requests, :info_request_events
+ fixtures :users, :outgoing_messages, :incoming_messages, :raw_emails, :info_requests, :info_request_events, :comments
it "should be successful" do
get :show, :url_name => "bob_smith"
diff --git a/spec/models/holiday_spec.rb b/spec/models/holiday_spec.rb
index ebfdeba4b..34526388d 100644
--- a/spec/models/holiday_spec.rb
+++ b/spec/models/holiday_spec.rb
@@ -4,7 +4,7 @@ describe Holiday, " when calculating due date" do
fixtures :holidays
def due_date(ymd)
- return Holiday.due_date_from(Date.strptime(ymd)).strftime("%F")
+ return Holiday.due_date_from(Date.strptime(ymd), 20).strftime("%F")
end
it "handles no holidays" do
@@ -43,7 +43,7 @@ describe Holiday, " when calculating due date" do
end
it "handles Time objects" do
- Holiday.due_date_from(Time.utc(2009, 03, 16, 12, 0, 0)).strftime('%F').should == '2009-04-16'
+ Holiday.due_date_from(Time.utc(2009, 03, 16, 12, 0, 0), 20).strftime('%F').should == '2009-04-16'
end
end
diff --git a/todo.txt b/todo.txt
index 24e31cb27..db697ff99 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,3 +1,8 @@
+overdue
+date_response_required_by
+waiting_response_overdue => waiting_response_slow, waiting_response_overdue
+
+
Move comments to use new system first
Show message to signed in user that others can't see this part
Make sure hidden things don't show in search snippets
@@ -5,6 +10,8 @@ Make sure hidden things don't show in search snippets
Remove comments visible
+Finish profile photo
+
test if get_attachments_for_display called multiple times in one request?