periodic_counter 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,12 +48,20 @@ class PeriodicCounter
48
48
  computed_at = data["#{col}_at"] || Time.now.utc
49
49
  duration = column_to_period_integer(col)
50
50
  time_since_compute = Time.now.utc - computed_at
51
+ last_day =
52
+ if col.include?('day')
53
+ self.class.today
54
+ elsif col.include?('week')
55
+ self.class.last_monday
56
+ elsif col.include?('month')
57
+ self.class.first_of_the_month
58
+ end
51
59
  if (time_since_compute - duration) >= 0
52
60
  data[col] = count
53
- data["#{col}_at"] = Time.now.utc
61
+ data["#{col}_at"] = last_day
54
62
  else
55
63
  data[col] ||= count
56
- data["#{col}_at"] ||= Time.now.utc
64
+ data["#{col}_at"] ||= last_day
57
65
  end
58
66
  record[col] = count - data[col].to_i
59
67
  end
@@ -80,4 +88,25 @@ class PeriodicCounter
80
88
  end
81
89
  eval(column.join('.'))
82
90
  end
91
+
92
+ class <<self
93
+
94
+ def first_of_the_month(now=Time.now.utc.to_date)
95
+ Date.new(now.year, now.month, 1).to_time(:utc)
96
+ end
97
+
98
+ def last_monday(now=Time.now.utc.to_date)
99
+ wday = now.wday
100
+ if wday == 0
101
+ -6
102
+ else
103
+ diff = 1 - wday
104
+ end
105
+ Date.new(now.year, now.month, now.day + diff).to_time(:utc)
106
+ end
107
+
108
+ def today(now=Time.now.utc.to_date)
109
+ Date.new(now.year, now.month, now.day).to_time(:utc)
110
+ end
111
+ end
83
112
  end
data/require.rb CHANGED
@@ -18,7 +18,7 @@ Require do
18
18
  name 'periodic_counter'
19
19
  homepage "http://github.com/winton/#{name}"
20
20
  summary "Maintains period fields on any counter column in your database"
21
- version '0.1.1'
21
+ version '0.1.2'
22
22
  end
23
23
 
24
24
  bin { require 'lib/periodic_counter' }
data/spec/log/test.log CHANGED
@@ -9957,6 +9957,606 @@ counter_last_day: 4
9957
9957
  counter_last_day_at: &id001 2010-06-12 22:18:56.313985 Z
9958
9958
  counter_last_2_days_at: *id001
9959
9959
  counter_last_2_days: 4
9960
+ ', counter_last_day = 0, counter_last_2_days = 0
9961
+ WHERE id = 1
9962
+ 
9963
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
9964
+ SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
9965
+ SQL (14.5ms) SHOW TABLES
9966
+ SQL (13.1ms) SELECT version FROM schema_migrations
9967
+ SQL (0.3ms) SHOW TABLES
9968
+ SQL (0.2ms) SELECT version FROM schema_migrations
9969
+ Migrating to Counters (1)
9970
+ SQL (0.2ms) SHOW TABLES
9971
+ SQL (0.2ms) SELECT version FROM schema_migrations
9972
+ SQL (0.2ms) SHOW TABLES
9973
+ SQL (0.1ms) SELECT version FROM schema_migrations
9974
+ Migrating to Counters (1)
9975
+ SQL (100.5ms) DROP TABLE `counters`
9976
+ SQL (0.9ms) DELETE FROM schema_migrations WHERE version = '1'
9977
+ SQL (0.4ms) SHOW TABLES
9978
+ SQL (0.3ms) SELECT version FROM schema_migrations
9979
+ SQL (0.3ms) SHOW TABLES
9980
+ SQL (0.2ms) SELECT version FROM schema_migrations
9981
+ Migrating to Counters (1)
9982
+ SQL (2.3ms) CREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB
9983
+ SQL (18.1ms) INSERT INTO schema_migrations (version) VALUES ('1')
9984
+ Counter Columns (187.3ms) SHOW FIELDS FROM `counters`
9985
+ SQL (0.1ms) BEGIN
9986
+ Counter Create (0.3ms) INSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)
9987
+ SQL (0.5ms) COMMIT
9988
+ SQL (0.3ms) SHOW TABLES
9989
+ SQL (1.3ms) SHOW FIELDS FROM `counters`
9990
+ SQL (1.6ms) SHOW FIELDS FROM `schema_migrations`
9991
+ SQL (0.2ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
9992
+ FROM counters
9993
+ 
9994
+ SQL (0.9ms)  UPDATE counters
9995
+ SET counter_data = '---
9996
+ counter_last_day: 1
9997
+ counter_last_day_at: 2010-06-14 00:00:00 Z
9998
+ counter_last_2_days_at: 2010-06-14 00:00:00 Z
9999
+ counter_last_2_days: 1
10000
+ ', counter_last_day = 0, counter_last_2_days = 0
10001
+ WHERE id = 1
10002
+ 
10003
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10004
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10005
+ SQL (0.1ms) BEGIN
10006
+ Counter Update (0.3ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1
10007
+ SQL (2.9ms) COMMIT
10008
+ SQL (0.3ms) SHOW TABLES
10009
+ SQL (1.8ms) SHOW FIELDS FROM `counters`
10010
+ SQL (1.5ms) SHOW FIELDS FROM `schema_migrations`
10011
+ SQL (3.1ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10012
+ FROM counters
10013
+ 
10014
+ SQL (0.7ms)  UPDATE counters
10015
+ SET counter_data = '---
10016
+ counter_last_day: 1
10017
+ counter_last_day_at: 2010-06-14 00:00:00 Z
10018
+ counter_last_2_days_at: 2010-06-14 00:00:00 Z
10019
+ counter_last_2_days: 1
10020
+ ', counter_last_day = 1, counter_last_2_days = 1
10021
+ WHERE id = 1
10022
+ 
10023
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10024
+ Counter Load (6.1ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10025
+ SQL (0.1ms) BEGIN
10026
+ Counter Update (0.3ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1
10027
+ SQL (0.5ms) COMMIT
10028
+ SQL (0.0ms) SHOW TABLES
10029
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10030
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10031
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10032
+ FROM counters
10033
+ 
10034
+ SQL (0.0ms)  UPDATE counters
10035
+ SET counter_data = '---
10036
+ counter_last_day: 3
10037
+ counter_last_day_at: 2010-06-15 23:46:45.964893 Z
10038
+ counter_last_2_days_at: 2010-06-14 00:00:00 Z
10039
+ counter_last_2_days: 1
10040
+ ', counter_last_day = 0, counter_last_2_days = 2
10041
+ WHERE id = 1
10042
+ 
10043
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10044
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10045
+ SQL (0.1ms) BEGIN
10046
+ Counter Update (0.2ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-15 23:46:45.964893 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1
10047
+ SQL (21.0ms) COMMIT
10048
+ SQL (0.0ms) SHOW TABLES
10049
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10050
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10051
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10052
+ FROM counters
10053
+ 
10054
+ SQL (0.0ms)  UPDATE counters
10055
+ SET counter_data = '---
10056
+ counter_last_day: 4
10057
+ counter_last_day_at: &id001 2010-06-16 23:46:46.005453 Z
10058
+ counter_last_2_days_at: *id001
10059
+ counter_last_2_days: 4
10060
+ ', counter_last_day = 0, counter_last_2_days = 0
10061
+ WHERE id = 1
10062
+ 
10063
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10064
+ SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
10065
+ SQL (0.7ms) SHOW TABLES
10066
+ SQL (0.2ms) SELECT version FROM schema_migrations
10067
+ SQL (0.3ms) SHOW TABLES
10068
+ SQL (0.2ms) SELECT version FROM schema_migrations
10069
+ Migrating to Counters (1)
10070
+ SQL (0.8ms) SHOW TABLES
10071
+ SQL (0.2ms) SELECT version FROM schema_migrations
10072
+ SQL (0.3ms) SHOW TABLES
10073
+ SQL (0.2ms) SELECT version FROM schema_migrations
10074
+ Migrating to Counters (1)
10075
+ SQL (21.3ms) DROP TABLE `counters`
10076
+ SQL (0.8ms) DELETE FROM schema_migrations WHERE version = '1'
10077
+ SQL (0.3ms) SHOW TABLES
10078
+ SQL (0.2ms) SELECT version FROM schema_migrations
10079
+ SQL (0.2ms) SHOW TABLES
10080
+ SQL (0.2ms) SELECT version FROM schema_migrations
10081
+ Migrating to Counters (1)
10082
+ SQL (22.0ms) CREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB
10083
+ SQL (0.7ms) INSERT INTO schema_migrations (version) VALUES ('1')
10084
+ Counter Columns (1.7ms) SHOW FIELDS FROM `counters`
10085
+ SQL (75.0ms) BEGIN
10086
+ Counter Create (0.3ms) INSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)
10087
+ SQL (0.6ms) COMMIT
10088
+ SQL (0.3ms) SHOW TABLES
10089
+ SQL (1.4ms) SHOW FIELDS FROM `counters`
10090
+ SQL (1.4ms) SHOW FIELDS FROM `schema_migrations`
10091
+ SQL (0.4ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10092
+ FROM counters
10093
+ 
10094
+ SQL (0.7ms)  UPDATE counters
10095
+ SET counter_data = '---
10096
+ counter_last_day: 1
10097
+ counter_last_day_at: 2010-06-14 00:00:00 Z
10098
+ counter_last_2_days_at: 2010-06-14 00:00:00 Z
10099
+ counter_last_2_days: 1
10100
+ ', counter_last_day = 0, counter_last_2_days = 0
10101
+ WHERE id = 1
10102
+ 
10103
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10104
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10105
+ SQL (0.1ms) BEGIN
10106
+ Counter Update (0.3ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1
10107
+ SQL (0.6ms) COMMIT
10108
+ SQL (0.9ms) SHOW TABLES
10109
+ SQL (3.2ms) SHOW FIELDS FROM `counters`
10110
+ SQL (1.7ms) SHOW FIELDS FROM `schema_migrations`
10111
+ SQL (0.4ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10112
+ FROM counters
10113
+ 
10114
+ SQL (0.7ms)  UPDATE counters
10115
+ SET counter_data = '---
10116
+ counter_last_day: 2
10117
+ counter_last_day_at: 2010-06-14 00:00:00 Z
10118
+ counter_last_2_days_at: 2010-06-14 00:00:00 Z
10119
+ counter_last_2_days: 1
10120
+ ', counter_last_day = 0, counter_last_2_days = 1
10121
+ WHERE id = 1
10122
+ 
10123
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10124
+ Counter Load (1.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10125
+ SQL (0.1ms) BEGIN
10126
+ Counter Update (0.4ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 2\ncounter_last_day_at: 2010-06-14 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-14 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1
10127
+ SQL (0.6ms) COMMIT
10128
+ SQL (0.0ms) SHOW TABLES
10129
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10130
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10131
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10132
+ FROM counters
10133
+ 
10134
+ SQL (0.0ms)  UPDATE counters
10135
+ SET counter_data = '---
10136
+ counter_last_day: 3
10137
+ counter_last_day_at: 2010-06-16 00:00:00 Z
10138
+ counter_last_2_days_at: 2010-06-16 00:00:00 Z
10139
+ counter_last_2_days: 3
10140
+ ', counter_last_day = 0, counter_last_2_days = 0
10141
+ WHERE id = 1
10142
+ 
10143
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10144
+ Counter Load (1.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10145
+ SQL (0.1ms) BEGIN
10146
+ Counter Update (0.3ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 3\ncounter_last_2_days_at: 2010-06-16 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1
10147
+ SQL (0.6ms) COMMIT
10148
+ SQL (0.0ms) SHOW TABLES
10149
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10150
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10151
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10152
+ FROM counters
10153
+ 
10154
+ SQL (0.0ms)  UPDATE counters
10155
+ SET counter_data = '---
10156
+ counter_last_day: 4
10157
+ counter_last_day_at: 2010-06-17 00:00:00 Z
10158
+ counter_last_2_days_at: 2010-06-16 00:00:00 Z
10159
+ counter_last_2_days: 3
10160
+ ', counter_last_day = 0, counter_last_2_days = 1
10161
+ WHERE id = 1
10162
+ 
10163
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10164
+ SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
10165
+ SQL (0.3ms) SHOW TABLES
10166
+ SQL (0.2ms) SELECT version FROM schema_migrations
10167
+ SQL (0.2ms) SHOW TABLES
10168
+ SQL (0.1ms) SELECT version FROM schema_migrations
10169
+ Migrating to Counters (1)
10170
+ SQL (0.2ms) SHOW TABLES
10171
+ SQL (0.1ms) SELECT version FROM schema_migrations
10172
+ SQL (0.2ms) SHOW TABLES
10173
+ SQL (0.1ms) SELECT version FROM schema_migrations
10174
+ Migrating to Counters (1)
10175
+ SQL (10.6ms) DROP TABLE `counters`
10176
+ SQL (0.7ms) DELETE FROM schema_migrations WHERE version = '1'
10177
+ SQL (0.2ms) SHOW TABLES
10178
+ SQL (0.1ms) SELECT version FROM schema_migrations
10179
+ SQL (0.2ms) SHOW TABLES
10180
+ SQL (0.1ms) SELECT version FROM schema_migrations
10181
+ Migrating to Counters (1)
10182
+ SQL (1.8ms) CREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB
10183
+ SQL (0.5ms) INSERT INTO schema_migrations (version) VALUES ('1')
10184
+ Counter Columns (1.4ms) SHOW FIELDS FROM `counters`
10185
+ SQL (0.1ms) BEGIN
10186
+ Counter Create (0.3ms) INSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)
10187
+ SQL (0.5ms) COMMIT
10188
+ SQL (0.6ms) SHOW TABLES
10189
+ SQL (1.0ms) SHOW FIELDS FROM `counters`
10190
+ SQL (1.7ms) SHOW FIELDS FROM `schema_migrations`
10191
+ SQL (0.4ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10192
+ FROM counters
10193
+ 
10194
+ SQL (31.1ms)  UPDATE counters
10195
+ SET counter_data = '---
10196
+ counter_last_day: 1
10197
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10198
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10199
+ counter_last_2_days: 1
10200
+ ', counter_last_day = 0, counter_last_2_days = 0
10201
+ WHERE id = 1
10202
+ 
10203
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10204
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10205
+ SQL (0.1ms) BEGIN
10206
+ Counter Update (3.7ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1
10207
+ SQL (0.4ms) COMMIT
10208
+ SQL (0.3ms) SHOW TABLES
10209
+ SQL (1.0ms) SHOW FIELDS FROM `counters`
10210
+ SQL (3.5ms) SHOW FIELDS FROM `schema_migrations`
10211
+ SQL (0.7ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10212
+ FROM counters
10213
+ 
10214
+ SQL (1.0ms)  UPDATE counters
10215
+ SET counter_data = '---
10216
+ counter_last_day: 1
10217
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10218
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10219
+ counter_last_2_days: 1
10220
+ ', counter_last_day = 1, counter_last_2_days = 1
10221
+ WHERE id = 1
10222
+ 
10223
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10224
+ Counter Load (0.7ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10225
+ SQL (0.1ms) BEGIN
10226
+ Counter Update (0.2ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1
10227
+ SQL (0.9ms) COMMIT
10228
+ SQL (0.0ms) SHOW TABLES
10229
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10230
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10231
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10232
+ FROM counters
10233
+ 
10234
+ SQL (0.0ms)  UPDATE counters
10235
+ SET counter_data = '---
10236
+ counter_last_day: 3
10237
+ counter_last_day_at: 2010-06-16 00:00:00 Z
10238
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10239
+ counter_last_2_days: 1
10240
+ ', counter_last_day = 0, counter_last_2_days = 2
10241
+ WHERE id = 1
10242
+ 
10243
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10244
+ Counter Load (0.7ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10245
+ SQL (0.1ms) BEGIN
10246
+ Counter Update (0.8ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1
10247
+ SQL (0.4ms) COMMIT
10248
+ SQL (0.0ms) SHOW TABLES
10249
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10250
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10251
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10252
+ FROM counters
10253
+ 
10254
+ SQL (0.0ms)  UPDATE counters
10255
+ SET counter_data = '---
10256
+ counter_last_day: 4
10257
+ counter_last_day_at: 2010-06-17 00:00:00 Z
10258
+ counter_last_2_days_at: 2010-06-17 00:00:00 Z
10259
+ counter_last_2_days: 4
10260
+ ', counter_last_day = 0, counter_last_2_days = 0
10261
+ WHERE id = 1
10262
+ 
10263
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10264
+ SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
10265
+ SQL (0.3ms) SHOW TABLES
10266
+ SQL (0.2ms) SELECT version FROM schema_migrations
10267
+ SQL (0.2ms) SHOW TABLES
10268
+ SQL (0.1ms) SELECT version FROM schema_migrations
10269
+ Migrating to Counters (1)
10270
+ SQL (0.2ms) SHOW TABLES
10271
+ SQL (0.1ms) SELECT version FROM schema_migrations
10272
+ SQL (0.2ms) SHOW TABLES
10273
+ SQL (0.1ms) SELECT version FROM schema_migrations
10274
+ Migrating to Counters (1)
10275
+ SQL (10.4ms) DROP TABLE `counters`
10276
+ SQL (0.8ms) DELETE FROM schema_migrations WHERE version = '1'
10277
+ SQL (0.2ms) SHOW TABLES
10278
+ SQL (0.1ms) SELECT version FROM schema_migrations
10279
+ SQL (0.2ms) SHOW TABLES
10280
+ SQL (0.2ms) SELECT version FROM schema_migrations
10281
+ Migrating to Counters (1)
10282
+ SQL (1.9ms) CREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB
10283
+ SQL (53.9ms) INSERT INTO schema_migrations (version) VALUES ('1')
10284
+ Counter Columns (1.3ms) SHOW FIELDS FROM `counters`
10285
+ SQL (0.8ms) BEGIN
10286
+ Counter Create (0.3ms) INSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)
10287
+ SQL (0.7ms) COMMIT
10288
+ SQL (0.3ms) SHOW TABLES
10289
+ SQL (10.9ms) SHOW FIELDS FROM `counters`
10290
+ SQL (1.5ms) SHOW FIELDS FROM `schema_migrations`
10291
+ SQL (0.7ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10292
+ FROM counters
10293
+ 
10294
+ SQL (0.6ms)  UPDATE counters
10295
+ SET counter_data = '---
10296
+ counter_last_day: 1
10297
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10298
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10299
+ counter_last_2_days: 1
10300
+ ', counter_last_day = 0, counter_last_2_days = 0
10301
+ WHERE id = 1
10302
+ 
10303
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10304
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10305
+ SQL (0.1ms) BEGIN
10306
+ Counter Update (1.7ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1
10307
+ SQL (1.4ms) COMMIT
10308
+ SQL (0.3ms) SHOW TABLES
10309
+ SQL (1.9ms) SHOW FIELDS FROM `counters`
10310
+ SQL (1.5ms) SHOW FIELDS FROM `schema_migrations`
10311
+ SQL (0.7ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10312
+ FROM counters
10313
+ 
10314
+ SQL (0.6ms)  UPDATE counters
10315
+ SET counter_data = '---
10316
+ counter_last_day: 1
10317
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10318
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10319
+ counter_last_2_days: 1
10320
+ ', counter_last_day = 1, counter_last_2_days = 1
10321
+ WHERE id = 1
10322
+ 
10323
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10324
+ Counter Load (0.6ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10325
+ SQL (0.1ms) BEGIN
10326
+ Counter Update (0.2ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1
10327
+ SQL (3.0ms) COMMIT
10328
+ SQL (0.0ms) SHOW TABLES
10329
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10330
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10331
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10332
+ FROM counters
10333
+ 
10334
+ SQL (0.0ms)  UPDATE counters
10335
+ SET counter_data = '---
10336
+ counter_last_day: 3
10337
+ counter_last_day_at: 2010-06-16 00:00:00 Z
10338
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10339
+ counter_last_2_days: 1
10340
+ ', counter_last_day = 0, counter_last_2_days = 2
10341
+ WHERE id = 1
10342
+ 
10343
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10344
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10345
+ SQL (0.1ms) BEGIN
10346
+ Counter Update (0.3ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1
10347
+ SQL (0.9ms) COMMIT
10348
+ SQL (0.0ms) SHOW TABLES
10349
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10350
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10351
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10352
+ FROM counters
10353
+ 
10354
+ SQL (0.0ms)  UPDATE counters
10355
+ SET counter_data = '---
10356
+ counter_last_day: 4
10357
+ counter_last_day_at: 2010-06-17 00:00:00 Z
10358
+ counter_last_2_days_at: 2010-06-17 00:00:00 Z
10359
+ counter_last_2_days: 4
10360
+ ', counter_last_day = 0, counter_last_2_days = 0
10361
+ WHERE id = 1
10362
+ 
10363
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10364
+ SQL (0.1ms) SET SQL_AUTO_IS_NULL=0
10365
+ SQL (0.3ms) SHOW TABLES
10366
+ SQL (0.2ms) SELECT version FROM schema_migrations
10367
+ SQL (0.2ms) SHOW TABLES
10368
+ SQL (0.1ms) SELECT version FROM schema_migrations
10369
+ Migrating to Counters (1)
10370
+ SQL (0.2ms) SHOW TABLES
10371
+ SQL (0.1ms) SELECT version FROM schema_migrations
10372
+ SQL (0.2ms) SHOW TABLES
10373
+ SQL (0.1ms) SELECT version FROM schema_migrations
10374
+ Migrating to Counters (1)
10375
+ SQL (45.9ms) DROP TABLE `counters`
10376
+ SQL (0.7ms) DELETE FROM schema_migrations WHERE version = '1'
10377
+ SQL (0.3ms) SHOW TABLES
10378
+ SQL (0.2ms) SELECT version FROM schema_migrations
10379
+ SQL (0.2ms) SHOW TABLES
10380
+ SQL (0.2ms) SELECT version FROM schema_migrations
10381
+ Migrating to Counters (1)
10382
+ SQL (2.0ms) CREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB
10383
+ SQL (0.6ms) INSERT INTO schema_migrations (version) VALUES ('1')
10384
+ Counter Columns (1.6ms) SHOW FIELDS FROM `counters`
10385
+ SQL (0.1ms) BEGIN
10386
+ Counter Create (0.3ms) INSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)
10387
+ SQL (0.5ms) COMMIT
10388
+ SQL (0.3ms) SHOW TABLES
10389
+ SQL (1.3ms) SHOW FIELDS FROM `counters`
10390
+ SQL (1.7ms) SHOW FIELDS FROM `schema_migrations`
10391
+ SQL (0.2ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10392
+ FROM counters
10393
+ 
10394
+ SQL (0.7ms)  UPDATE counters
10395
+ SET counter_data = '---
10396
+ counter_last_day: 1
10397
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10398
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10399
+ counter_last_2_days: 1
10400
+ ', counter_last_day = 0, counter_last_2_days = 0
10401
+ WHERE id = 1
10402
+ 
10403
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10404
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10405
+ SQL (0.1ms) BEGIN
10406
+ Counter Update (0.4ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1
10407
+ SQL (0.8ms) COMMIT
10408
+ SQL (0.3ms) SHOW TABLES
10409
+ SQL (1.3ms) SHOW FIELDS FROM `counters`
10410
+ SQL (13.1ms) SHOW FIELDS FROM `schema_migrations`
10411
+ SQL (0.3ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10412
+ FROM counters
10413
+ 
10414
+ SQL (0.8ms)  UPDATE counters
10415
+ SET counter_data = '---
10416
+ counter_last_day: 1
10417
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10418
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10419
+ counter_last_2_days: 1
10420
+ ', counter_last_day = 1, counter_last_2_days = 1
10421
+ WHERE id = 1
10422
+ 
10423
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10424
+ Counter Load (0.3ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10425
+ SQL (0.8ms) BEGIN
10426
+ Counter Update (0.3ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1
10427
+ SQL (0.6ms) COMMIT
10428
+ SQL (0.0ms) SHOW TABLES
10429
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10430
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10431
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10432
+ FROM counters
10433
+ 
10434
+ SQL (0.0ms)  UPDATE counters
10435
+ SET counter_data = '---
10436
+ counter_last_day: 3
10437
+ counter_last_day_at: 2010-06-16 00:00:00 Z
10438
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10439
+ counter_last_2_days: 1
10440
+ ', counter_last_day = 0, counter_last_2_days = 2
10441
+ WHERE id = 1
10442
+ 
10443
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10444
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10445
+ SQL (0.1ms) BEGIN
10446
+ Counter Update (0.2ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1
10447
+ SQL (1.0ms) COMMIT
10448
+ SQL (0.0ms) SHOW TABLES
10449
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10450
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10451
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10452
+ FROM counters
10453
+ 
10454
+ SQL (0.0ms)  UPDATE counters
10455
+ SET counter_data = '---
10456
+ counter_last_day: 4
10457
+ counter_last_day_at: 2010-06-17 00:00:00 Z
10458
+ counter_last_2_days_at: 2010-06-17 00:00:00 Z
10459
+ counter_last_2_days: 4
10460
+ ', counter_last_day = 0, counter_last_2_days = 0
10461
+ WHERE id = 1
10462
+ 
10463
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10464
+ SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
10465
+ SQL (0.3ms) SHOW TABLES
10466
+ SQL (0.3ms) SELECT version FROM schema_migrations
10467
+ SQL (0.2ms) SHOW TABLES
10468
+ SQL (0.1ms) SELECT version FROM schema_migrations
10469
+ Migrating to Counters (1)
10470
+ SQL (0.2ms) SHOW TABLES
10471
+ SQL (0.1ms) SELECT version FROM schema_migrations
10472
+ SQL (0.2ms) SHOW TABLES
10473
+ SQL (0.1ms) SELECT version FROM schema_migrations
10474
+ Migrating to Counters (1)
10475
+ SQL (36.2ms) DROP TABLE `counters`
10476
+ SQL (0.7ms) DELETE FROM schema_migrations WHERE version = '1'
10477
+ SQL (0.4ms) SHOW TABLES
10478
+ SQL (0.2ms) SELECT version FROM schema_migrations
10479
+ SQL (0.2ms) SHOW TABLES
10480
+ SQL (0.2ms) SELECT version FROM schema_migrations
10481
+ Migrating to Counters (1)
10482
+ SQL (2.0ms) CREATE TABLE `counters` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `counter` int(11), `counter_last_day` int(11), `counter_last_2_days` int(11), `counter_data` varchar(2048)) ENGINE=InnoDB
10483
+ SQL (0.9ms) INSERT INTO schema_migrations (version) VALUES ('1')
10484
+ Counter Columns (74.3ms) SHOW FIELDS FROM `counters`
10485
+ SQL (0.4ms) BEGIN
10486
+ Counter Create (0.3ms) INSERT INTO `counters` (`counter_data`, `counter_last_day`, `counter`, `counter_last_2_days`) VALUES(NULL, NULL, 1, NULL)
10487
+ SQL (0.4ms) COMMIT
10488
+ SQL (0.3ms) SHOW TABLES
10489
+ SQL (1.1ms) SHOW FIELDS FROM `counters`
10490
+ SQL (1.5ms) SHOW FIELDS FROM `schema_migrations`
10491
+ SQL (0.7ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10492
+ FROM counters
10493
+ 
10494
+ SQL (0.6ms)  UPDATE counters
10495
+ SET counter_data = '---
10496
+ counter_last_day: 1
10497
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10498
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10499
+ counter_last_2_days: 1
10500
+ ', counter_last_day = 0, counter_last_2_days = 0
10501
+ WHERE id = 1
10502
+ 
10503
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10504
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10505
+ SQL (0.1ms) BEGIN
10506
+ Counter Update (0.4ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 2 WHERE `id` = 1
10507
+ SQL (0.7ms) COMMIT
10508
+ SQL (0.2ms) SHOW TABLES
10509
+ SQL (1.4ms) SHOW FIELDS FROM `counters`
10510
+ SQL (1.3ms) SHOW FIELDS FROM `schema_migrations`
10511
+ SQL (0.7ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10512
+ FROM counters
10513
+ 
10514
+ SQL (0.8ms)  UPDATE counters
10515
+ SET counter_data = '---
10516
+ counter_last_day: 1
10517
+ counter_last_day_at: 2010-06-15 00:00:00 Z
10518
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10519
+ counter_last_2_days: 1
10520
+ ', counter_last_day = 1, counter_last_2_days = 1
10521
+ WHERE id = 1
10522
+ 
10523
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10524
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10525
+ SQL (0.1ms) BEGIN
10526
+ Counter Update (0.2ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 1\ncounter_last_day_at: 2010-06-15 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 3 WHERE `id` = 1
10527
+ SQL (0.4ms) COMMIT
10528
+ SQL (0.0ms) SHOW TABLES
10529
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10530
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10531
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10532
+ FROM counters
10533
+ 
10534
+ SQL (0.0ms)  UPDATE counters
10535
+ SET counter_data = '---
10536
+ counter_last_day: 3
10537
+ counter_last_day_at: 2010-06-16 00:00:00 Z
10538
+ counter_last_2_days_at: 2010-06-15 00:00:00 Z
10539
+ counter_last_2_days: 1
10540
+ ', counter_last_day = 0, counter_last_2_days = 2
10541
+ WHERE id = 1
10542
+ 
10543
+ Counter Load (0.0ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10544
+ Counter Load (0.2ms) SELECT * FROM `counters` ORDER BY counters.id DESC LIMIT 1
10545
+ SQL (0.1ms) BEGIN
10546
+ Counter Update (0.2ms) UPDATE `counters` SET `counter_data` = '--- \ncounter_last_day: 3\ncounter_last_day_at: 2010-06-16 00:00:00 Z\ncounter_last_2_days: 1\ncounter_last_2_days_at: 2010-06-15 00:00:00 Z\n', `counter` = 4 WHERE `id` = 1
10547
+ SQL (0.4ms) COMMIT
10548
+ SQL (0.0ms) SHOW TABLES
10549
+ SQL (0.0ms) SHOW FIELDS FROM `counters`
10550
+ SQL (0.0ms) SHOW FIELDS FROM `schema_migrations`
10551
+ SQL (0.0ms)  SELECT id, counter, counter_data, counter_last_day, counter_last_2_days
10552
+ FROM counters
10553
+ 
10554
+ SQL (0.0ms)  UPDATE counters
10555
+ SET counter_data = '---
10556
+ counter_last_day: 4
10557
+ counter_last_day_at: 2010-06-17 00:00:00 Z
10558
+ counter_last_2_days_at: 2010-06-17 00:00:00 Z
10559
+ counter_last_2_days: 4
9960
10560
  ', counter_last_day = 0, counter_last_2_days = 0
9961
10561
  WHERE id = 1
9962
10562
  
@@ -13,8 +13,8 @@ describe PeriodicCounter do
13
13
  start
14
14
  attributes = Counter.last.attributes
15
15
  data = attributes.delete('counter_data')
16
- data.delete('counter_last_day_at').to_s.should == Time.now.utc.to_s
17
- data.delete('counter_last_2_days_at').to_s.should == Time.now.utc.to_s
16
+ data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
17
+ data.delete('counter_last_2_days_at').to_s.should == PeriodicCounter.today.to_s
18
18
  data.should == {
19
19
  "counter_last_day"=>1,
20
20
  "counter_last_2_days"=>1
@@ -32,8 +32,8 @@ describe PeriodicCounter do
32
32
  start
33
33
  attributes = Counter.last.attributes
34
34
  data = attributes.delete('counter_data')
35
- data.delete('counter_last_day_at').to_s.should == Time.now.utc.to_s
36
- data.delete('counter_last_2_days_at').to_s.should == Time.now.utc.to_s
35
+ data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
36
+ data.delete('counter_last_2_days_at').to_s.should == PeriodicCounter.today.to_s
37
37
  data.should == {
38
38
  "counter_last_day"=>1,
39
39
  "counter_last_2_days"=>1
@@ -52,8 +52,8 @@ describe PeriodicCounter do
52
52
  start
53
53
  attributes = Counter.last.attributes
54
54
  data = attributes.delete('counter_data')
55
- data.delete('counter_last_day_at').to_s.should == Time.now.utc.to_s
56
- data.delete('counter_last_2_days_at').to_s.should == (Time.now - 1.day).utc.to_s
55
+ data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
56
+ data.delete('counter_last_2_days_at').to_s.should == (PeriodicCounter.today - 1.day).to_s
57
57
  data.should == {
58
58
  "counter_last_day"=>3,
59
59
  "counter_last_2_days"=>1
@@ -72,8 +72,8 @@ describe PeriodicCounter do
72
72
  start
73
73
  attributes = Counter.last.attributes
74
74
  data = attributes.delete('counter_data')
75
- data.delete('counter_last_day_at').to_s.should == Time.now.utc.to_s
76
- data.delete('counter_last_2_days_at').to_s.should == Time.now.utc.to_s
75
+ data.delete('counter_last_day_at').to_s.should == PeriodicCounter.today.to_s
76
+ data.delete('counter_last_2_days_at').to_s.should == PeriodicCounter.today.to_s
77
77
  data.should == {
78
78
  "counter_last_day"=>4,
79
79
  "counter_last_2_days"=>4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: periodic_counter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-06-10 00:00:00 -07:00
12
+ date: 2010-06-14 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency