Skip to content

Commit

Permalink
Merge branch 'master' of github.com:OPORA/publicwhip-drohobych
Browse files Browse the repository at this point in the history
  • Loading branch information
beastie87 committed May 30, 2018
2 parents 0a06ad0 + 23c0452 commit f50ef7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def init
end
end
def divisions
@divisions = Division.all
@divisions = Division.all.order(date: :desc)
div = @divisions.page(params[:page])
current = div.current_page
total = div.total_pages
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/deputi_cashe.rake
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ namespace :deputi_cashe do
end
desc "Update mp cashe"
task mp: :environment do
@mp = Mp.all
@mp = Mp.where(end_date: '9999-12-31')
@mp.each do |m|
if Mp.where(faction: m.faction, end_date: '9999-12-31').count >= 5
rebellions = Division.joins(:whips, :votes).where('votes.deputy_id = ?', m.id ).where('whips.party = ?', m.faction).where("votes.vote != 'absent'").where('votes.vote != whips.whip_guess').count
else
rebellions = nil
end
v = Vote.where(deputy_id: m.id).map {|v| v}
v = Vote.joins(:mp).where("mps.deputy_id = ?", m.deputy_id).map {|v| v}
hash = {
not_voted: v.count{|v| v.vote == "not_voted"},
absent: v.count{|v| v.vote == "absent"},
Expand Down

0 comments on commit f50ef7d

Please sign in to comment.