rails_admin_charts 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_admin_charts.rb +3 -3
- data/lib/rails_admin_charts/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e62900d965ae0d4923160d4b8eb68bffb75fd44b
|
4
|
+
data.tar.gz: b6e3aef9a8d190c871da55c078e458fcf2da9e0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdf82ac4b2b2666eee840f66d1a5e84516751a7049c4d722c0164fa897fdaf84ec2df97d4be99359f4961d45d9de6b11ee23112ed3aac157dbdd7b011f37e0e4
|
7
|
+
data.tar.gz: 80420584ed3204599738d3041372322e5ff673688bdbb79ea3942960375a3f68feca06224721c83db86d474df960a1a839f1e01c1e6121d412cdd36c37fa1a51
|
data/lib/rails_admin_charts.rb
CHANGED
@@ -9,15 +9,15 @@ module RailsAdminCharts
|
|
9
9
|
module ClassMethods
|
10
10
|
def total_records_since(since = 30.days.ago)
|
11
11
|
totals, before_count = self.group('DATE(created_at)').count, self.where('created_at < ?', since.to_date).count
|
12
|
-
(since.to_date..Date.today).each_with_object([]) { |day, a| a << (a.last || before_count) + (totals[day] || 0) }
|
12
|
+
(since.to_date..Date.today).each_with_object([]) { |day, a| a << (a.last || before_count) + (totals[day.to_s] || 0) }
|
13
13
|
end
|
14
14
|
|
15
15
|
def delta_records_since(since = 30.days.ago)
|
16
16
|
deltas = self.group('DATE(created_at)').count
|
17
|
-
(since.to_date..Date.today).map { |date| deltas[date] || 0 }
|
17
|
+
(since.to_date..Date.today).map { |date| deltas[date.to_s] || 0 }
|
18
18
|
end
|
19
19
|
|
20
|
-
def graph_data
|
20
|
+
def graph_data(since=30.days.ago)
|
21
21
|
[
|
22
22
|
{
|
23
23
|
name: model_name.plural,
|