stat_board 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 714d8cf51a57406f3e98bce6f897cdcfc0e9a9d7
4
- data.tar.gz: fa217da108f3d63a92d3e7b952e15c5f8c060a8f
3
+ metadata.gz: a04643e2df929f159881e7a111f56616413ae785
4
+ data.tar.gz: adcc487ac6cee8d3c66dbe3979b87ec6a66cfb2c
5
5
  SHA512:
6
- metadata.gz: f645fa8393b2eac0e327cf21bc684ae8fc9b2f343770c9b4d8f5bdd74e2f09916aa405228963e98b8c3d22ee72755dbbc52b7c75c678c879f7c8451ea4db6d63
7
- data.tar.gz: 53320913aad40ed6d6d1c2a9ce4b722607bcc7cb685d38109ef39be9d84b48d3d3816421504fda343158f5d4be15a9c861cee3553785f01d3f7198080302b853
6
+ metadata.gz: bf217ffa0a5c974bae0e2145cb8d77683e98080076b8be24339ecec169efbd829294cf3187b952685c552274980f2d2c0df93eee424fb4ad52dd47b6d3a1d3bd
7
+ data.tar.gz: a3abae285a32bc1d7688c26b029ba770cdf6c177cf4587ab6efb0837bbdf8195baa1a6eff5bc476bea5f30aebdf4251ebd29baaf9d34596e9c4ffeef1be8e706
data/README.markdown CHANGED
@@ -83,3 +83,11 @@ In order to setup the databases locally, you'll need to: `bundle exec rake db:mi
83
83
  StatBoard is released under the [MIT License][mit]. See MIT-LICENSE for further details.
84
84
 
85
85
  [mit]: http://www.opensource.org/licenses/MIT
86
+
87
+ ***
88
+
89
+ <a href="http://code.viget.com">
90
+ <img src="http://code.viget.com/github-banner.png" alt="Code At Viget">
91
+ </a>
92
+
93
+ Visit [code.viget.com](http://code.viget.com) to see more projects from [Viget.](https://viget.com)
@@ -14,11 +14,27 @@ module StatBoard
14
14
  # along the date_range, on every displayed interval
15
15
  def resources_by_date(klass_name)
16
16
  klass = klass_name.to_s.constantize
17
- created_ats = klass.pluck(:created_at).compact.map(&:to_date)
18
-
19
- date_range.step(date_steps).map do |date|
20
- created_ats.count{|c_a| c_a < date}
21
- end.to_s
17
+ created_ats = klass.order(:created_at).pluck(:created_at).compact
18
+ steps = date_range.step(date_steps).map(&:end_of_day)
19
+ index = 0
20
+ counts = created_ats.reduce(Hash.new(0)) do |counts, timestamp|
21
+ cutoff = steps[index]
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
22
38
  end
23
39
 
24
40
  private
@@ -1,3 +1,3 @@
1
1
  module StatBoard
2
- VERSION = '0.1.9'
2
+ VERSION = '0.1.10'
3
3
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stat_board
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Eisinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2016-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: launchy
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: capybara
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.1.4
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.1.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: capybara-webkit
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.13.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.13.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: database_cleaner
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: appraisal
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: Simple dashboard of records created this week, this month, and all time,
@@ -158,6 +158,9 @@ executables: []
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
+ - MIT-LICENSE
162
+ - README.markdown
163
+ - Rakefile
161
164
  - app/assets/javascripts/stat_board/highcharts.js
162
165
  - app/assets/stylesheets/stat_board/bootstrap.css
163
166
  - app/controllers/stat_board/application_controller.rb
@@ -169,6 +172,7 @@ files:
169
172
  - config/routes.rb
170
173
  - lib/generators/stat_board/install_generator.rb
171
174
  - lib/generators/stat_board/templates/initializer.rb
175
+ - lib/stat_board.rb
172
176
  - lib/stat_board/engine.rb
173
177
  - lib/stat_board/graph_helper.rb
174
178
  - lib/stat_board/reports/monthly_report.rb
@@ -177,11 +181,7 @@ files:
177
181
  - lib/stat_board/reports/weekly_report.rb
178
182
  - lib/stat_board/reports_finder.rb
179
183
  - lib/stat_board/version.rb
180
- - lib/stat_board.rb
181
184
  - lib/tasks/stat_board_tasks.rake
182
- - MIT-LICENSE
183
- - Rakefile
184
- - README.markdown
185
185
  homepage: https://github.com/vigetlabs/stat_board
186
186
  licenses:
187
187
  - MIT
@@ -192,17 +192,17 @@ require_paths:
192
192
  - lib
193
193
  required_ruby_version: !ruby/object:Gem::Requirement
194
194
  requirements:
195
- - - '>='
195
+ - - ">="
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - '>='
200
+ - - ">="
201
201
  - !ruby/object:Gem::Version
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.0.3
205
+ rubygems_version: 2.4.5.1
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: Simple dashboard of records created this week, this month, and all time,