redtastic 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDVkOWRlMWFhMzE2MGYzZGYyOWNiMzdlMTM0Mzg2M2Q0OTg2NTFiMg==
5
- data.tar.gz: !binary |-
6
- MzkxNTcxMGMyZGVjNGJjYzVhYWExYTAzNjk0ZjFkY2Q5YzgxOTk1Nw==
2
+ SHA1:
3
+ metadata.gz: 861a12fa35fa9f12ce98f02a903f5009e1774ce0
4
+ data.tar.gz: b3182c21c83d2dd90c76981c712f219a79f7e2af
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MWRkYzk3MmU1MjkyZGU3ODRkYzFjMTk0MWE0YWI4N2ZiM2RhNDU5NTFkN2Y1
10
- MDFmY2I3MjdmMDE4MjVhMGJjOWRmOTg4ZWJlMDZkMmFhMjdlYzJmZmZmZTBk
11
- N2MxZTlkMWIyYjg1MGNhZjcyOTQ1OGUxMjRjODQxNmY0MWE5ODU=
12
- data.tar.gz: !binary |-
13
- MzIwOWIwOTY5NGExY2RkNTM4ZmE3YjMwY2JmOGM4MmQwMDJiNzU2MjZlODk3
14
- ODk1YmRkZTk3OGI0MGU1MjA0ZDU4MDYyOGRlODQ1YmU3NDZlMDQ4MWE5MDUx
15
- M2FiZDE4NzIwYjQ1MmQ0MGJjZmYzY2E4MDU5MWM3MDNhYmMxNjY=
6
+ metadata.gz: 18b1c126af13fbb63102eb4915292183109e0a6964fd08191189cbe46bef69c034832fd95de0a65c0b0be7e2fe16107f3fdee71a6871a14691560eff94a8fb2d
7
+ data.tar.gz: a20adec1b09e6b2bb3d84bf6041688960fa5bbef05c02b47d7537cbc3c9aa8dc74b9ec8a9a10ee23caa183b799e0dd0f71cfbd9d6bdd3f94368512bf8ebb6094
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ master
2
+ ======
3
+ * Added a CHANGELOG
4
+ * [Fix for dates on weekly metrics](https://github.com/bellycard/redtastic/pull/37)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redtastic (0.3.2)
4
+ redtastic (0.3.3)
5
5
  activesupport
6
6
  redis
7
7
 
@@ -235,7 +235,7 @@ module Redtastic
235
235
  timestamp.strftime('%Y-%m-%d')
236
236
  when :weeks
237
237
  week_number = timestamp.cweek
238
- result = timestamp.strftime('%Y')
238
+ result = timestamp.cwyear.to_s
239
239
  result + "-W#{week_number}"
240
240
  when :months
241
241
  timestamp.strftime('%Y-%m')
@@ -1,3 +1,3 @@
1
1
  module Redtastic
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
data/spec/model_spec.rb CHANGED
@@ -267,27 +267,43 @@ describe Redtastic::Model do
267
267
  end
268
268
 
269
269
  context 'and is weeks' do
270
- before do
271
- @params[:interval] = :weeks
272
- @result = Visits.aggregate(@params)
273
- end
270
+ context 'for weeks in the same year' do
271
+ before do
272
+ @params[:interval] = :weeks
273
+ @result = Visits.aggregate(@params)
274
+ end
274
275
 
275
- it 'returns the total over the date range' do
276
- expect(@result[:visits]).to eq(8)
277
- end
276
+ it 'returns the total over the date range' do
277
+ expect(@result[:visits]).to eq(8)
278
+ end
278
279
 
279
- it 'returns the proper amount of data points' do
280
- expect(@result[:weeks].size).to eq(2)
281
- end
280
+ it 'returns the proper amount of data points' do
281
+ expect(@result[:weeks].size).to eq(2)
282
+ end
282
283
 
283
- it 'returns the correct data for each point in the interval' do
284
- expect(@result[:weeks][0][:visits]).to eq(5)
285
- expect(@result[:weeks][1][:visits]).to eq(3)
284
+ it 'returns the correct data for each point in the interval' do
285
+ expect(@result[:weeks][0][:visits]).to eq(5)
286
+ expect(@result[:weeks][1][:visits]).to eq(3)
287
+ end
288
+
289
+ it 'returns the correct dates for each point in the interval' do
290
+ expect(@result[:weeks][0][:date]).to eq('2014-W1')
291
+ expect(@result[:weeks][1][:date]).to eq('2014-W2')
292
+ end
286
293
  end
287
294
 
288
- it 'returns the correct dates for each point in the interval' do
289
- expect(@result[:weeks][0][:date]).to eq('2014-W1')
290
- expect(@result[:weeks][1][:date]).to eq('2014-W2')
295
+ context 'for weeks over two different years' do
296
+ before do
297
+ @params[:interval] = :weeks
298
+ @params[:start_date] = '2015-12-25'
299
+ @params[:end_date] = '2016-01-03'
300
+ @result = Visits.aggregate(@params)
301
+ end
302
+
303
+ it 'returns the correct dates' do
304
+ expect(@result[:weeks][0][:date]).to eq('2015-W52')
305
+ expect(@result[:weeks][1][:date]).to eq('2015-W53')
306
+ end
291
307
  end
292
308
  end
293
309
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redtastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe DiVita
@@ -14,129 +14,129 @@ dependencies:
14
14
  name: redis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '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: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
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: :runtime
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: dotenv
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: rspec
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: pry
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: git
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
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: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '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'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
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: coveralls
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
- description: ! ' A simple, Redis-backed interface for storing, retrieving, and aggregating
139
+ description: ' A simple, Redis-backed interface for storing, retrieving, and aggregating
140
140
  analytics '
141
141
  email:
142
142
  - joediv31@gmail.com
@@ -147,6 +147,7 @@ files:
147
147
  - .gitignore
148
148
  - .rubocop.yml
149
149
  - .travis.yml
150
+ - CHANGELOG.md
150
151
  - Gemfile
151
152
  - Gemfile.lock
152
153
  - README.md
@@ -180,17 +181,17 @@ require_paths:
180
181
  - lib
181
182
  required_ruby_version: !ruby/object:Gem::Requirement
182
183
  requirements:
183
- - - ! '>='
184
+ - - '>='
184
185
  - !ruby/object:Gem::Version
185
186
  version: '0'
186
187
  required_rubygems_version: !ruby/object:Gem::Requirement
187
188
  requirements:
188
- - - ! '>='
189
+ - - '>='
189
190
  - !ruby/object:Gem::Version
190
191
  version: '0'
191
192
  requirements: []
192
193
  rubyforge_project:
193
- rubygems_version: 2.2.1
194
+ rubygems_version: 2.0.14
194
195
  signing_key:
195
196
  specification_version: 4
196
197
  summary: A simple, Redis-backed interface for storing, retrieving, and aggregating