Browse files

remove rescue from get_distributions

  • Loading branch information...
1 parent f29d600 commit f912dc467660bb2b69514f63ac2e872c69aab963 @lukebaker lukebaker committed Jul 24, 2013
Showing with 12 additions and 2 deletions.
  1. +12 −2 app/controllers/abingo_dashboard_controller.rb
View
14 app/controllers/abingo_dashboard_controller.rb
@@ -146,10 +146,20 @@ def get_distributions(session_list, objects_by_session_ids, alternatives)
uploader_distribution[a.content] = Hash.new(0)
end
session_list.each do |s|
- num = objects_by_session_ids[s['session_id']]['votes'] rescue 0
+ sess = objects_by_session_ids[s['session_id']]
+ if sess.nil?
+ num = 0
+ else
+ num = sess['votes']
+ end
voter_distribution[s['content']][num.to_i] +=1
- num = objects_by_session_ids[s['session_id']]['ideas'] rescue 0
+ sess = objects_by_session_ids[s['session_id']]
+ if sess.nil?
+ num = 0
+ else
+ num = sess['ideas']
+ end
uploader_distribution[s['content']][num.to_i] +=1
end
[voter_distribution, uploader_distribution]

0 comments on commit f912dc4

Please sign in to comment.