stat_board 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stat_board/graph_helper.rb +6 -22
- data/lib/stat_board/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de0bd3c95825876eee22d01d934b8289212e806ce954a817567f9c5fb3fed2d7
|
4
|
+
data.tar.gz: 452130740530b8fc1da4d3bb301618fbbf6b16ed29dabbebbe75c0c687d41419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0013c7c2908001696a1ed86c7286b7ae02dbc9a0481a7c81eb5af49cb5e795afbd52f7c272a9e1c4e8aac4fdfa2af65a074909793b3193aa4722e9ba5879a71d
|
7
|
+
data.tar.gz: 897ea2ade4d762b3b88dc56137d5a358589e08e5915e23c1bcaf966128b7e17cac79c82116392d3ed293b9512f34dd6a877a757fa8aacce178bfaa5d4868f71e
|
@@ -13,28 +13,12 @@ module StatBoard
|
|
13
13
|
# a string of the array of the count of (klass) objects
|
14
14
|
# along the date_range, on every displayed interval
|
15
15
|
def resources_by_date(klass_name)
|
16
|
-
klass
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
# As long as timestamps have not exceeded the last date step
|
24
|
-
if cutoff.present?
|
25
|
-
if timestamp < cutoff
|
26
|
-
counts[cutoff] += 1
|
27
|
-
else
|
28
|
-
index += 1
|
29
|
-
next_cutoff = steps[index]
|
30
|
-
counts[next_cutoff] += (counts[cutoff] + 1) if next_cutoff.present?
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
counts
|
35
|
-
end
|
36
|
-
|
37
|
-
counts.values.to_s
|
16
|
+
klass = klass_name.to_s.constantize
|
17
|
+
steps = date_range.step(date_steps).map(&:end_of_day)
|
18
|
+
|
19
|
+
steps.map do |step_end|
|
20
|
+
klass.where("created_at <= ?", step_end).count
|
21
|
+
end.to_s
|
38
22
|
end
|
39
23
|
|
40
24
|
private
|
data/lib/stat_board/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stat_board
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Eisinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -201,7 +201,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
201
|
- !ruby/object:Gem::Version
|
202
202
|
version: '0'
|
203
203
|
requirements: []
|
204
|
-
|
204
|
+
rubyforge_project:
|
205
|
+
rubygems_version: 2.7.6
|
205
206
|
signing_key:
|
206
207
|
specification_version: 4
|
207
208
|
summary: Simple dashboard of records created this week, this month, and all time,
|