36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/services/lesli_audit/user_service.rb', line 36
def registrations
period = "month"
group = query[:group]
period = group unless group.blank?
registrations = []
if ["day", "week", "month", "year"].include?(period)
registrations = current_user.account.users
.group("DATE_TRUNC('#{period}', created_at)")
.count
.map do |request|
{
:date => Date2.new(request[0]).date.to_s,
:count => request[1]
}
end
end
registrations
end
|