aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/public_body.rb10
-rw-r--r--app/views/admin_public_body/show.rhtml4
-rw-r--r--todo.txt2
3 files changed, 13 insertions, 3 deletions
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index b95aa6c88..e27f2bb68 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -25,7 +25,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body.rb,v 1.138 2009-03-22 14:21:56 tony Exp $
+# $Id: public_body.rb,v 1.139 2009-04-02 15:33:11 francis Exp $
require 'csv'
require 'set'
@@ -464,6 +464,14 @@ class PublicBody < ActiveRecord::Base
return ret
end
+ def reverse_sorted_versions
+ self.versions.sort { |a,b| b.version <=> a.version }
+ end
+ def sorted_versions
+ self.versions.sort { |a,b| a.version <=> b.version }
+ end
+
+
end
diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml
index eaf6c10da..3366b73ce 100644
--- a/app/views/admin_public_body/show.rhtml
+++ b/app/views/admin_public_body/show.rhtml
@@ -48,7 +48,7 @@
<th>Updated at</th>
</tr>
<%# There may be an option to versions() to specify order, but I can't find it. TB 2009-03-09 %>
-<% for historic_public_body in @public_body.versions.sort { |a,b| b.version <=> a.version } %>
+<% for historic_public_body in @public_body.reverse_sorted_versions %>
<tr class="<%= cycle('odd', 'even') %>">
<% for column in history_columns %>
<%
@@ -57,7 +57,7 @@
value = historic_public_body.last_edit_comment_for_html_display
end
# Highlight entries which have changed since previous version
- changed = (not ['version', 'last_edit_editor', 'last_edit_comment'].include?(column.name)) && ((historic_public_body.send(column.name) != @public_body.versions[historic_public_body.version - 2].send(column.name)) || (historic_public_body.version == 1)) %>
+ changed = (!['version', 'last_edit_editor', 'last_edit_comment'].include?(column.name)) && ((historic_public_body.send(column.name) != @public_body.sorted_versions[historic_public_body.version - 2].send(column.name)) || (historic_public_body.version == 1)) %>
<td <%= changed ? ' class="entry_changed" ': '' %> >
<%=value%>
</td>
diff --git a/todo.txt b/todo.txt
index 9a512ea90..e8ba5efb5 100644
--- a/todo.txt
+++ b/todo.txt
@@ -321,6 +321,8 @@ Quoting fixing TODO:
http://www.whatdotheyknow.com/request/224/response/589 # have knackered the apostrophes here
+ http://www.whatdotheyknow.com/request/operation_oasis_protester_databa#incoming-20922
+
Unclassified:
http://www.whatdotheyknow.com/request/666/response/1020
http://www.whatdotheyknow.com/request/364/response/1100