Merge master
This commit is contained in:
commit
a56a0e7547
2 changed files with 13 additions and 11 deletions
|
|
@ -376,8 +376,8 @@ GEM
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
slop (~> 3.4)
|
slop (~> 3.4)
|
||||||
public_suffix (3.1.1)
|
public_suffix (3.1.1)
|
||||||
puma (3.12.4)
|
puma (3.12.6)
|
||||||
rack (2.0.8)
|
rack (2.1.4)
|
||||||
rack-openid (1.3.1)
|
rack-openid (1.3.1)
|
||||||
rack (>= 1.1.0)
|
rack (>= 1.1.0)
|
||||||
ruby-openid (>= 2.1.8)
|
ruby-openid (>= 2.1.8)
|
||||||
|
|
@ -599,7 +599,7 @@ GEM
|
||||||
hashdiff
|
hashdiff
|
||||||
websocket-driver (0.7.1)
|
websocket-driver (0.7.1)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.4)
|
websocket-extensions (0.1.5)
|
||||||
whenever (0.10.0)
|
whenever (0.10.0)
|
||||||
chronic (>= 0.6.3)
|
chronic (>= 0.6.3)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserDatatable < AjaxDatatablesRails::Base
|
class UserDatatable < AjaxDatatablesRails::Base
|
||||||
|
|
@ -40,20 +41,21 @@ 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).select(
|
User.left_outer_joins(:registrations, :roles)
|
||||||
"DISTINCT users.id, users.name, users.email, users.confirmed_at, COUNT(CASE WHEN registrations.attended = 't' THEN 1 END) AS attended_count"
|
.distinct
|
||||||
).group(
|
.select("users.*, COUNT(CASE WHEN registrations.attended = 't' THEN 1 END) AS attended_count")
|
||||||
'users.id, users.name, users.email, users.confirmed_at'
|
.group('users.id')
|
||||||
)
|
|
||||||
end
|
end
|
||||||
# rubocop:enable Naming/AccessorMethodName
|
# rubocop:enable Naming/AccessorMethodName
|
||||||
|
|
||||||
|
# Workaround for jbox-web/ajax-datatables-rails#293
|
||||||
def records_total_count
|
def records_total_count
|
||||||
fetch_records.unscoped.count(:id)
|
fetch_records.unscope(:group, :select).count(:all)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Workaround for jbox-web/ajax-datatables-rails#293
|
||||||
def records_filtered_count
|
def records_filtered_count
|
||||||
filter_records(fetch_records).unscoped.count
|
filter_records(fetch_records).unscope(:group, :select).count(:all)
|
||||||
end
|
end
|
||||||
|
|
||||||
# ==== These methods represent the basic operations to perform on records
|
# ==== These methods represent the basic operations to perform on records
|
||||||
|
|
@ -69,4 +71,4 @@ class UserDatatable < AjaxDatatablesRails::Base
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# ==== Insert 'presenter'-like methods below if necessary
|
# ==== Insert 'presenter'-like methods below if necessary
|
||||||
end
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue