Permalink
Browse files

working json filter, return only filter info

  • Loading branch information...
1 parent f770375 commit b8bc452d43347ea10bdf8a3b49a0906e894408ad @alx committed Jul 19, 2011
@@ -24,9 +24,10 @@
get '/heatmap' do
content_type :json
+ $SEATS.each{|seat| seat[:count] = 0}
month = 201104
3.times do
- parse_synthese "#{month}"
+ parse_synthese "#{month}", params[:info]
month += 1
end
max = 0
@@ -56,11 +56,23 @@ def api_json(json_url)
end
end
-def parse_synthese(date)
+def parse_synthese(date, info)
json = api_json("http://www.nosdeputes.fr/synthese/#{date}/json")
json["deputes"].each do |depute_json|
depute = depute_json["depute"]
- nb_interventions = depute["hemicycle_interventions"]
+
+ nb_interventions = case info
+ when "amendements"
+ depute["amendements_adoptes"] + depute["amendements_signes"]
+ when "commissions"
+ depute["commission_interventions"] + depute["commission_presences"]
+ when "hemicycle"
+ depute["hemicycle_interventions"] + depute["hemicycle_interventions_courtes"]
+ when "propositions"
+ depute["propositions_ecrites"] + depute["propositions_signees"]
+ when "questions"
+ depute["questions_ecrites"] + depute["questions_orales"]
+ end
seat_index = $NAMES.index{|store| store[:name] == depute["nom"]}
if seat_index.to_i > 0 && nb_interventions > 0
if seat = $SEATS.select{|seat| seat[:id] == seat_index}.first
@@ -1,3 +1,7 @@
+.container {
+ margin-top:10px;
+}
+
#heatmapArea {
position: relative;
float: left;
@@ -12,15 +16,15 @@
color: white;
padding: 3px 5px 5px 10px;
position: relative;
- top: 3px;
+ top: 1px;
}
#heatmap_tooltip{
background: #009;
color: white;
padding: 3px 5px 5px 10px;
position: relative;
- top: 3px;
+ top: 1px;
}
#filter{
Oops, something went wrong.

0 comments on commit b8bc452

Please sign in to comment.