Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken links on dashboard, was: JC ArgumentError: wrong number of arguments (given 5, expected 1..2) #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions lib/simple/sql/connection/scope/count_by_groups.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ def count_by(sql_fragment)
end

def count_by_estimate(sql_fragment)
return count_by(sql_fragment)

# The code below runs an estimate on the effort to count by a group. This is currently
# disabled (see https://issues.mediafellows.com/issues/75237).

sql = order_by(nil).to_sql(pagination: false)
cost = @connection.estimate_cost "SELECT COUNT(*) FROM (#{sql}) sq GROUP BY #{sql_fragment}", *args

Expand All @@ -67,7 +62,7 @@ def count_by_estimate(sql_fragment)
counts = {}
sparse_groups = []
enumerate_groups(sql_fragment).each do |group|
scope = @connection.scope("SELECT * FROM (#{sql}) sq WHERE #{sql_fragment}=#{var_name}", *args, group)
scope = @connection.scope("SELECT * FROM (#{sql}) sq WHERE #{sql_fragment}=#{var_name}", args + [group])
estimated_count = scope.send(:estimated_count)
counts[group] = estimated_count
sparse_groups << group if estimated_count < EXACT_COUNT_THRESHOLD
Expand Down