Skip to content

Commit

Permalink
Fixed group SQL optimization to not duplicate query when just users a…
Browse files Browse the repository at this point in the history
…re in audience
  • Loading branch information
Ethan Waldo committed Sep 13, 2010
1 parent 94a3959 commit 0677618
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/audience.rb
Expand Up @@ -109,7 +109,7 @@ def prepare_recipients(options = {})
sql += " AND `audiences_jurisdictions`.audience_id = #{self.id} AND `role_memberships`.jurisdiction_id = `audiences_jurisdictions`.jurisdiction_id" if has_jurisdictions
sql += "#{publicsql})"
sql += " UNION DISTINCT " if has_users
else
elsif has_jurisdictions
sql += "(SELECT DISTINCT `users`.id, `users`.last_name, `users`.display_name, `users`.email"
sql += ", (#{subselect}) AS memberships" if options[:role_memberships]
if options[:devices]
Expand Down

0 comments on commit 0677618

Please sign in to comment.