-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved generation of bill_events for third reading bills - turn imp…
…rest debates into third readings
- Loading branch information
robmckinnon
committed
Jul 27, 2011
1 parent
8acd51e
commit 7b74fa2
Showing
11 changed files
with
113 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
- if debate.contributions.size > 100 | ||
= render :partial => 'contribution', :collection => debate.contributions[0..100], :locals => { :debate => debate } | ||
- if debate.contributions.size > 115 | ||
= render :partial => 'contribution', :collection => debate.contributions[0..115], :locals => { :debate => debate } | ||
%div | ||
%p | ||
= "[... plus a further #{debate.contributions.size - 100} contributions not shown here]" | ||
= "[... plus a further #{debate.contributions.size - 115} contributions not shown here]" | ||
- else | ||
= render :partial => 'contribution', :collection => debate.contributions, :locals => { :debate => debate } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
namespace :kiwimp do | ||
|
||
desc 'convert imprest supply debates to third reading debates' | ||
task :clean_imprest => [:environment] do | ||
debates = Debate.find_by_sql("select * from debates where name like 'Appropriation%' and type != 'SubDebate'") ; nil | ||
subdebates = debates.map {|x| x.sub_debates}.flatten ; nil | ||
empty_debates = subdebates.select{|x| x.contributions.empty?} ; nil | ||
parent_debates = empty_debates.map(&:parent) ; nil | ||
imprest_debates = parent_debates.map{|x| x.sub_debates }.flatten.select {|x| x.name == 'Imprest Supply Debate'} ; nil | ||
events = imprest_debates.map{|x| x.bill_events}.flatten.select {|x| x.name == 'Imprest Supply Debate'} ; nil | ||
events.each {|x| x.name = 'Third Reading' ; x.save } ; nil | ||
imprest_debates.each {|x| x.name = 'Third Reading' ; x.save } ; nil | ||
|
||
empty_debates.each {|x| x.destroy} ; nil | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters