Skip to content

Commit

Permalink
Query for diversity stats as boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
futureperfect authored and kormoc committed Jun 3, 2018
1 parent 1e4a60d commit 659e12e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/conference.rb
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,11 @@ def diversity_distribution(state = nil)
result = {}

if state
count_yes = program.events.select(:diversity).where('diversity = ?', 1).where('state = ?', state).group(:diversity).count[true]
count_no = program.events.select(:diversity).where('diversity = ?', 0).where('state = ?', state).group(:diversity).count[false]
count_yes = program.events.select(:diversity).where(diversity: true).where('state = ?', state).group(:diversity).count[true]
count_no = program.events.select(:diversity).where(diversity: false).where('state = ?', state).group(:diversity).count[false]
else
count_yes = program.events.select(:diversity).where('diversity = ?', 1).group(:diversity).count[true]
count_no = program.events.select(:diversity).where('diversity = ?', 0).group(:diversity).count[false]
count_yes = program.events.select(:diversity).where(diversity: true).group(:diversity).count[true]
count_no = program.events.select(:diversity).where(diversity: false).group(:diversity).count[false]
end

if count_yes.nil?
Expand Down

0 comments on commit 659e12e

Please sign in to comment.