Not ruby-ish but this should work
This commit is contained in:
parent
dbe0b1c09c
commit
29f6a41c98
1 changed files with 5 additions and 4 deletions
|
|
@ -40,10 +40,11 @@ class UserDatatable < AjaxDatatablesRails::Base
|
||||||
|
|
||||||
# rubocop:disable Naming/AccessorMethodName
|
# rubocop:disable Naming/AccessorMethodName
|
||||||
def get_raw_records
|
def get_raw_records
|
||||||
User.left_outer_joins(:registrations, :roles)
|
User.left_outer_joins(:registrations, :roles).distinct.select(
|
||||||
.distinct
|
"users.*, COUNT(CASE WHEN registrations.attended = 't' THEN 1 END) AS attended_count"
|
||||||
.select("users.*, COUNT(CASE WHEN registrations.attended = 't' THEN 1 END) AS attended_count")
|
).group(
|
||||||
# .group('users.id, users.name, users.email, users.confirmed_at')
|
'users.id, users.name, users.email, users.confirmed_at'
|
||||||
|
)
|
||||||
end
|
end
|
||||||
# rubocop:enable Naming/AccessorMethodName
|
# rubocop:enable Naming/AccessorMethodName
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue