punching_bag 0.3.9 → 0.4.0

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: 6fe63b6081c438a8ced17c1944be138097f4d2b3
4
- data.tar.gz: 3b7fc5756851039af3a0b82e195fc537b46541ce
3
+ metadata.gz: 1d21d475f8e6bab6ed6c1ad87a6173bff0c106bf
4
+ data.tar.gz: a0f6478508647cbfc15db9b36babe83846cc84c3
5
5
  SHA512:
6
- metadata.gz: 9204bfffe1fc54c04d96587f9b3737ddf988763c3d94dd4393e562610cb55c00d4a06359768cf71f5685c73604801e774125bbaf326490233fbc9b4bacfed056
7
- data.tar.gz: 4707eb7c9625426f0a2c5621ab25e25c585a2953dddd00b58bbf2139809b0f1733a3e448f1e6736679f3fa8b8a5a07f67fbfc36de7eddce7ffd03d62dcdd64df
6
+ metadata.gz: 17388f6730ae75872f8c87ea4f224f9ee27b2b2008fe0037a996bce96fbccb6d68ba7138aae6a537d60030ed66fb0786c4629045556b2e5fb4141744de7f7b09
7
+ data.tar.gz: ce9324f0eaf67e6ab02242ef9952a956a51a028a1d7a20433b0d33b07a7a9ae21fd19c888ad44ab2fec9e94071be52829a421d9705776ff46c827245c738095b
@@ -5,7 +5,7 @@ class Punch < ActiveRecord::Base
5
5
  before_validation :set_defaults
6
6
  validates :punchable_id, :punchable_type, :starts_at, :ends_at, :average_time, :hits, :presence => true
7
7
 
8
- default_scope { order 'punches.average_time DESC' }
8
+ default_scope -> { order 'punches.average_time DESC' }
9
9
  scope :combos, -> { where 'punches.hits > 1' }
10
10
  scope :jabs, -> { where hits: 1 }
11
11
  scope :before, ->(time = nil) { where('punches.ends_at <= ?', time) unless time.nil? }
@@ -13,6 +13,7 @@ class Punch < ActiveRecord::Base
13
13
  scope :by_timeframe, ->(timeframe, time) {
14
14
  where('punches.starts_at >= ? AND punches.ends_at <= ?', time.send("beginning_of_#{timeframe}"), time.send("end_of_#{timeframe}"))
15
15
  }
16
+ scope :by_hour, ->(hour) { by_timeframe :hour, hour }
16
17
  scope :by_day, ->(day) { by_timeframe :day, day }
17
18
  scope :by_month, ->(month) { by_timeframe :month, month }
18
19
  scope :by_year, ->(year) {
@@ -34,23 +35,29 @@ class Punch < ActiveRecord::Base
34
35
  :year
35
36
  elsif starts_at.day != ends_at.day
36
37
  :month
37
- elsif starts_at != ends_at
38
+ elsif starts_at.hour != ends_at.hour
38
39
  :day
40
+ elsif starts_at != ends_at
41
+ :hour
39
42
  else
40
43
  :second
41
44
  end
42
45
  end
43
46
 
47
+ def hour_combo?
48
+ timeframe == :hour and not find_true_combo_for(:hour) == self
49
+ end
50
+
44
51
  def day_combo?
45
- timeframe == :day
52
+ timeframe == :day and not find_true_combo_for(:day) == self
46
53
  end
47
54
 
48
55
  def month_combo?
49
- timeframe == :month
56
+ timeframe == :month and not find_true_combo_for(:month) == self
50
57
  end
51
58
 
52
59
  def year_combo?
53
- timeframe == :year
60
+ timeframe == :year and not find_true_combo_for(:year) == self
54
61
  end
55
62
 
56
63
  def find_combo_for(timeframe)
@@ -58,6 +65,10 @@ class Punch < ActiveRecord::Base
58
65
  punches.combos.first || punches.first
59
66
  end
60
67
 
68
+ def find_true_combo_for(timeframe)
69
+ punchable.punches.combos.by_timeframe(timeframe, average_time).first
70
+ end
71
+
61
72
  def combine_with(combo)
62
73
  if combo && combo != self
63
74
  combo.starts_at = starts_at if starts_at < combo.starts_at
@@ -69,6 +80,12 @@ class Punch < ActiveRecord::Base
69
80
  combo
70
81
  end
71
82
 
83
+ def combine_by_hour
84
+ unless hour_combo? || day_combo? || month_combo? || year_combo?
85
+ combine_with find_combo_for(:hour)
86
+ end
87
+ end
88
+
72
89
  def combine_by_day
73
90
  unless day_combo? || month_combo? || year_combo?
74
91
  combine_with find_combo_for(:day)
@@ -99,38 +116,6 @@ class Punch < ActiveRecord::Base
99
116
  sums.values.inject(:+).to_f / sums.length
100
117
  end
101
118
 
102
- def self.combine_by_day(punchable)
103
- combine_by :day, punchable
104
- end
105
-
106
- def self.combine_by_monthday(punchable)
107
- combine_by :month, punchable
108
- end
109
-
110
- def self.combine_by_year(punchable)
111
- combine_by :year, punchable
112
- end
113
-
114
- def self.combine_by(timeframe, punchable)
115
- combo = nil
116
- punches = punchable.punches.by_timeframe(timeframe)
117
-
118
- if punches.length > 1
119
- timestamps = punches.map{|p| [p.average_time.to_i] * p.hits}.flatten
120
-
121
- combo = Punch.new(punchable: punchable)
122
- combo.starts_at = punches.map(&:starts_at).min
123
- combo.ends_at = punches.map(&:ends_at).max
124
- combo.average_time = Time.at(timestamps.sum / timestamps.length).to_datetime
125
- combo.hits = punches.map(&:hits).sum
126
- combo.save!
127
-
128
- punches.delete_all
129
- end
130
-
131
- combo
132
- end
133
-
134
119
  private
135
120
 
136
121
  def set_defaults
@@ -1,3 +1,3 @@
1
1
  module PunchingBag
2
- VERSION = '0.3.9'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -1,30 +1,39 @@
1
1
  namespace :punching_bag do
2
2
  desc 'Combine old hit records together to improve performance'
3
- task :combine, [:by_day_after, :by_month_after, :by_year_after] => [:environment] do |t, args|
4
- args.with_defaults :by_day_after => 7, :by_month_after => 1, :by_year_after => 1
3
+ task :combine, [:by_hour_after, :by_day_after, :by_month_after, :by_year_after] => [:environment] do |t, args|
4
+ args.with_defaults :by_hour_after => 24, :by_day_after => 7, :by_month_after => 1, :by_year_after => 1
5
5
 
6
6
  punchable_types = Punch.uniq.pluck(:punchable_type)
7
7
 
8
8
  punchable_types.each do |punchable_type|
9
- punchable_ids = Punch.uniq.where(punchable_type: punchable_type).pluck(:punchable_id)
10
-
11
- punchable_ids.each do |punchable_id|
12
- punchable = punchable_type.constantize.find(punchable_id)
9
+ punchables = punchable_type.constantize.find(
10
+ Punch.uniq.where(punchable_type: punchable_type).pluck(:punchable_id)
11
+ )
13
12
 
13
+ punchables.each do |punchable|
14
14
  # by_year
15
15
  punchable.punches.before(args[:by_year_after].to_i.years.ago).each do |punch|
16
+ punch.reload # Dont use the cached version - we might have changed if we were the combo
16
17
  punch.combine_by_year
17
18
  end
18
19
 
19
20
  # by_month
20
21
  punchable.punches.before(args[:by_month_after].to_i.months.ago).each do |punch|
22
+ punch.reload # Dont use the cached version - we might have changed if we were the combo
21
23
  punch.combine_by_month
22
24
  end
23
25
 
24
26
  # by_day
25
27
  punchable.punches.before(args[:by_day_after].to_i.days.ago).each do |punch|
28
+ punch.reload # Dont use the cached version - we might have changed if we were the combo
26
29
  punch.combine_by_day
27
30
  end
31
+
32
+ # by_hour
33
+ punchable.punches.before(args[:by_hour_after].to_i.hours.ago).each do |punch|
34
+ punch.reload # Dont use the cached version - we might have changed if we were the combo
35
+ punch.combine_by_hour
36
+ end
28
37
  end
29
38
  end
30
39
  end
@@ -19245,3 +19245,476 @@
19245
19245
  SQL (0.5ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2014-07-25 15:30:13.942364"], ["ends_at", "2014-07-25 15:30:13.942364"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2014-07-25 15:30:13.942364"]]
19246
19246
   (0.1ms) RELEASE SAVEPOINT active_record_1
19247
19247
   (0.3ms) rollback transaction
19248
+  (0.4ms) begin transaction
19249
+  (0.1ms) SAVEPOINT active_record_1
19250
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Ding, ding ding... ding. Ding. DING. DING! "], ["created_at", "2015-01-05 21:10:12.791459"], ["title", "Hector"], ["updated_at", "2015-01-05 21:10:12.791459"]]
19251
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19252
+  (0.2ms) rollback transaction
19253
+  (0.1ms) begin transaction
19254
+  (0.1ms) SELECT COUNT(*) FROM "punches"
19255
+  (0.1ms) SAVEPOINT active_record_1
19256
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Ding, ding ding... ding. Ding. DING. DING! "], ["created_at", "2015-01-05 21:10:12.801622"], ["title", "Hector"], ["updated_at", "2015-01-05 21:10:12.801622"]]
19257
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19258
+  (0.1ms) SAVEPOINT active_record_1
19259
+ SQL (0.5ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:12.812967"], ["ends_at", "2015-01-05 21:10:12.812967"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:12.812967"]]
19260
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19261
+  (0.1ms) SELECT COUNT(*) FROM "punches"
19262
+  (0.2ms) rollback transaction
19263
+  (0.1ms) begin transaction
19264
+  (0.2ms) SELECT COUNT(*) FROM "punches"
19265
+  (0.1ms) SAVEPOINT active_record_1
19266
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Ding, ding ding... ding. Ding. DING. DING! "], ["created_at", "2015-01-05 21:10:12.819502"], ["title", "Hector"], ["updated_at", "2015-01-05 21:10:12.819502"]]
19267
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19268
+  (0.0ms) SAVEPOINT active_record_1
19269
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:12.821544"], ["ends_at", "2015-01-05 21:10:12.821544"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:12.821544"]]
19270
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19271
+  (0.1ms) SELECT COUNT(*) FROM "punches"
19272
+  (0.2ms) rollback transaction
19273
+  (0.1ms) begin transaction
19274
+  (0.1ms) rollback transaction
19275
+  (0.1ms) begin transaction
19276
+  (0.0ms) SAVEPOINT active_record_1
19277
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.828594"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.828594"]]
19278
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19279
+  (0.2ms) rollback transaction
19280
+  (0.1ms) begin transaction
19281
+  (0.0ms) SAVEPOINT active_record_1
19282
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.832196"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.832196"]]
19283
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19284
+  (0.2ms) rollback transaction
19285
+  (0.1ms) begin transaction
19286
+  (0.0ms) SAVEPOINT active_record_1
19287
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.835631"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.835631"]]
19288
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19289
+  (0.2ms) rollback transaction
19290
+  (0.1ms) begin transaction
19291
+  (0.1ms) SAVEPOINT active_record_1
19292
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.839421"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.839421"]]
19293
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19294
+  (0.2ms) rollback transaction
19295
+  (0.1ms) begin transaction
19296
+  (0.1ms) SAVEPOINT active_record_1
19297
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.843784"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.843784"]]
19298
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19299
+  (0.3ms) rollback transaction
19300
+  (0.1ms) begin transaction
19301
+  (0.1ms) SAVEPOINT active_record_1
19302
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.849548"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.849548"]]
19303
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19304
+  (0.2ms) rollback transaction
19305
+  (0.1ms) begin transaction
19306
+  (0.0ms) SAVEPOINT active_record_1
19307
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.853911"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.853911"]]
19308
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19309
+  (0.2ms) rollback transaction
19310
+  (0.1ms) begin transaction
19311
+  (0.0ms) SAVEPOINT active_record_1
19312
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.857650"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.857650"]]
19313
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19314
+  (0.1ms) rollback transaction
19315
+  (0.1ms) begin transaction
19316
+  (0.0ms) SAVEPOINT active_record_1
19317
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.861064"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.861064"]]
19318
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19319
+  (0.2ms) rollback transaction
19320
+  (0.1ms) begin transaction
19321
+  (0.1ms) SAVEPOINT active_record_1
19322
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.864527"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.864527"]]
19323
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19324
+  (0.2ms) rollback transaction
19325
+  (0.0ms) begin transaction
19326
+  (0.1ms) SAVEPOINT active_record_1
19327
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.868230"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.868230"]]
19328
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19329
+  (0.2ms) rollback transaction
19330
+  (0.1ms) begin transaction
19331
+  (0.1ms) SAVEPOINT active_record_1
19332
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.872305"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.872305"]]
19333
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19334
+ Punch Load (0.2ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.hits > 1) AND (punches.starts_at >= '2015-01-05 00:00:00.000000' AND punches.ends_at <= '2015-01-05 23:59:59.999999') ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19335
+  (0.2ms) rollback transaction
19336
+  (0.1ms) begin transaction
19337
+  (0.1ms) SAVEPOINT active_record_1
19338
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.889074"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.889074"]]
19339
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19340
+  (0.2ms) rollback transaction
19341
+  (0.0ms) begin transaction
19342
+  (0.1ms) SAVEPOINT active_record_1
19343
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.892747"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.892747"]]
19344
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19345
+  (0.2ms) rollback transaction
19346
+  (0.1ms) begin transaction
19347
+  (0.0ms) SAVEPOINT active_record_1
19348
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.896610"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.896610"]]
19349
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19350
+  (0.2ms) rollback transaction
19351
+  (0.1ms) begin transaction
19352
+  (0.0ms) SAVEPOINT active_record_1
19353
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.900226"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.900226"]]
19354
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19355
+  (0.3ms) rollback transaction
19356
+  (0.1ms) begin transaction
19357
+  (0.1ms) SAVEPOINT active_record_1
19358
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.905685"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.905685"]]
19359
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19360
+ Punch Load (0.3ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.hits > 1) AND (punches.starts_at >= '2015-01-01 00:00:00.000000' AND punches.ends_at <= '2015-01-31 23:59:59.999999') ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19361
+  (0.2ms) rollback transaction
19362
+  (0.1ms) begin transaction
19363
+  (0.1ms) SAVEPOINT active_record_1
19364
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.913121"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.913121"]]
19365
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19366
+  (0.2ms) rollback transaction
19367
+  (0.1ms) begin transaction
19368
+  (0.1ms) SAVEPOINT active_record_1
19369
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.917172"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.917172"]]
19370
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19371
+  (0.2ms) rollback transaction
19372
+  (0.1ms) begin transaction
19373
+  (0.0ms) SAVEPOINT active_record_1
19374
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.920777"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.920777"]]
19375
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19376
+  (0.1ms) rollback transaction
19377
+  (0.0ms) begin transaction
19378
+  (0.0ms) SAVEPOINT active_record_1
19379
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.924338"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.924338"]]
19380
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19381
+  (0.2ms) rollback transaction
19382
+  (0.1ms) begin transaction
19383
+  (0.1ms) SAVEPOINT active_record_1
19384
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.928057"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.928057"]]
19385
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19386
+ Punch Load (0.3ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.hits > 1) AND (punches.starts_at >= '2015-01-01 00:00:00.000000' AND punches.ends_at <= '2015-12-31 23:59:59.999999') ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19387
+  (0.2ms) rollback transaction
19388
+  (0.1ms) begin transaction
19389
+  (0.1ms) SAVEPOINT active_record_1
19390
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.935478"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.935478"]]
19391
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19392
+  (0.1ms) SAVEPOINT active_record_1
19393
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:12.937733"], ["ends_at", "2015-01-05 21:10:12.937733"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:12.937733"]]
19394
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19395
+  (0.2ms) SELECT COUNT(*) FROM "punches"
19396
+  (0.1ms) SELECT COUNT(*) FROM "punches"
19397
+  (0.2ms) rollback transaction
19398
+  (0.1ms) begin transaction
19399
+  (0.0ms) SAVEPOINT active_record_1
19400
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.944040"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.944040"]]
19401
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19402
+  (0.1ms) SAVEPOINT active_record_1
19403
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 10:00:00.000000"], ["ends_at", "2015-01-05 10:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 10:00:00.000000"]]
19404
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19405
+  (0.1ms) SAVEPOINT active_record_1
19406
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-12 08:00:00.000000"], ["ends_at", "2015-01-12 08:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-12 08:00:00.000000"]]
19407
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19408
+  (0.0ms) SAVEPOINT active_record_1
19409
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 09:00:00.000000"], ["ends_at", "2015-01-05 09:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 09:00:00.000000"]]
19410
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19411
+  (0.0ms) SAVEPOINT active_record_1
19412
+ SQL (0.2ms) UPDATE "punches" SET "average_time" = ?, "hits" = ?, "starts_at" = ? WHERE "punches"."id" = 1 [["average_time", "2015-01-05 09:30:00.000000"], ["hits", 2], ["starts_at", "2015-01-05 09:00:00.000000"]]
19413
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19414
+  (0.0ms) SAVEPOINT active_record_1
19415
+ SQL (0.1ms) DELETE FROM "punches" WHERE "punches"."id" = ? [["id", 3]]
19416
+  (0.0ms) RELEASE SAVEPOINT active_record_1
19417
+  (0.3ms) rollback transaction
19418
+  (0.1ms) begin transaction
19419
+  (0.1ms) SAVEPOINT active_record_1
19420
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.956043"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.956043"]]
19421
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19422
+  (0.1ms) SAVEPOINT active_record_1
19423
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 10:00:00.000000"], ["ends_at", "2015-01-05 10:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 10:00:00.000000"]]
19424
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19425
+  (0.1ms) SAVEPOINT active_record_1
19426
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-12 08:00:00.000000"], ["ends_at", "2015-01-12 08:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-12 08:00:00.000000"]]
19427
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19428
+  (0.0ms) SAVEPOINT active_record_1
19429
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 09:00:00.000000"], ["ends_at", "2015-01-05 09:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 09:00:00.000000"]]
19430
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19431
+  (0.1ms) SAVEPOINT active_record_1
19432
+ SQL (0.1ms) UPDATE "punches" SET "average_time" = ?, "hits" = ?, "starts_at" = ? WHERE "punches"."id" = 1 [["average_time", "2015-01-05 09:30:00.000000"], ["hits", 2], ["starts_at", "2015-01-05 09:00:00.000000"]]
19433
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19434
+  (0.1ms) SAVEPOINT active_record_1
19435
+ SQL (0.2ms) DELETE FROM "punches" WHERE "punches"."id" = ? [["id", 3]]
19436
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19437
+  (0.3ms) rollback transaction
19438
+  (0.1ms) begin transaction
19439
+  (0.1ms) SAVEPOINT active_record_1
19440
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.969076"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.969076"]]
19441
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19442
+  (0.1ms) SAVEPOINT active_record_1
19443
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 10:00:00.000000"], ["ends_at", "2015-01-05 10:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 10:00:00.000000"]]
19444
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19445
+  (0.1ms) SAVEPOINT active_record_1
19446
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-12 08:00:00.000000"], ["ends_at", "2015-01-12 08:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-12 08:00:00.000000"]]
19447
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19448
+  (0.0ms) SAVEPOINT active_record_1
19449
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 09:00:00.000000"], ["ends_at", "2015-01-05 09:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 09:00:00.000000"]]
19450
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19451
+  (0.0ms) SAVEPOINT active_record_1
19452
+ SQL (0.1ms) UPDATE "punches" SET "average_time" = ?, "hits" = ?, "starts_at" = ? WHERE "punches"."id" = 1 [["average_time", "2015-01-05 09:30:00.000000"], ["hits", 2], ["starts_at", "2015-01-05 09:00:00.000000"]]
19453
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19454
+  (0.0ms) SAVEPOINT active_record_1
19455
+ SQL (0.1ms) DELETE FROM "punches" WHERE "punches"."id" = ? [["id", 3]]
19456
+  (0.0ms) RELEASE SAVEPOINT active_record_1
19457
+  (0.2ms) rollback transaction
19458
+  (0.1ms) begin transaction
19459
+  (0.1ms) SAVEPOINT active_record_1
19460
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.980612"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.980612"]]
19461
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19462
+  (0.1ms) SAVEPOINT active_record_1
19463
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 10:00:00.000000"], ["ends_at", "2015-01-05 10:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 10:00:00.000000"]]
19464
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19465
+  (0.1ms) SAVEPOINT active_record_1
19466
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-12 08:00:00.000000"], ["ends_at", "2015-01-12 08:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-12 08:00:00.000000"]]
19467
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19468
+  (0.0ms) SAVEPOINT active_record_1
19469
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 09:00:00.000000"], ["ends_at", "2015-01-05 09:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 09:00:00.000000"]]
19470
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19471
+  (0.0ms) SAVEPOINT active_record_1
19472
+ SQL (0.1ms) UPDATE "punches" SET "average_time" = ?, "hits" = ?, "starts_at" = ? WHERE "punches"."id" = 1 [["average_time", "2015-01-05 09:30:00.000000"], ["hits", 2], ["starts_at", "2015-01-05 09:00:00.000000"]]
19473
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19474
+  (0.0ms) SAVEPOINT active_record_1
19475
+ SQL (0.1ms) DELETE FROM "punches" WHERE "punches"."id" = ? [["id", 3]]
19476
+  (0.0ms) RELEASE SAVEPOINT active_record_1
19477
+  (0.2ms) rollback transaction
19478
+  (0.1ms) begin transaction
19479
+  (0.0ms) SAVEPOINT active_record_1
19480
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:12.991110"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:12.991110"]]
19481
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19482
+  (0.1ms) SAVEPOINT active_record_1
19483
+ SQL (0.4ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 10:00:00.000000"], ["ends_at", "2015-01-05 10:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 10:00:00.000000"]]
19484
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19485
+  (0.1ms) SAVEPOINT active_record_1
19486
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-12 08:00:00.000000"], ["ends_at", "2015-01-12 08:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-12 08:00:00.000000"]]
19487
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19488
+  (0.1ms) SAVEPOINT active_record_1
19489
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 09:00:00.000000"], ["ends_at", "2015-01-05 09:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 09:00:00.000000"]]
19490
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19491
+ Punch Load (0.2ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.starts_at >= '2015-01-05 00:00:00.000000' AND punches.ends_at <= '2015-01-05 23:59:59.999999') AND (id != 3) AND (punches.hits > 1) ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19492
+ Punch Load (0.2ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.starts_at >= '2015-01-05 00:00:00.000000' AND punches.ends_at <= '2015-01-05 23:59:59.999999') AND (id != 3) ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19493
+  (0.2ms) rollback transaction
19494
+  (0.1ms) begin transaction
19495
+  (0.1ms) SAVEPOINT active_record_1
19496
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "I know, I just call her Annabelle cause she's shaped like a... she's the belle of the ball!"], ["created_at", "2015-01-05 21:10:13.005534"], ["title", "Bluths"], ["updated_at", "2015-01-05 21:10:13.005534"]]
19497
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19498
+  (0.1ms) SAVEPOINT active_record_1
19499
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 10:00:00.000000"], ["ends_at", "2015-01-05 10:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 10:00:00.000000"]]
19500
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19501
+  (0.0ms) SAVEPOINT active_record_1
19502
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-12 08:00:00.000000"], ["ends_at", "2015-01-12 08:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-12 08:00:00.000000"]]
19503
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19504
+  (0.1ms) SAVEPOINT active_record_1
19505
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 09:00:00.000000"], ["ends_at", "2015-01-05 09:00:00.000000"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 09:00:00.000000"]]
19506
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19507
+ Punch Load (0.1ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.starts_at >= '2015-01-05 00:00:00.000000' AND punches.ends_at <= '2015-01-05 23:59:59.999999') AND (id != 3) AND (punches.hits > 1) ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19508
+ Punch Load (0.1ms) SELECT "punches".* FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? AND (punches.starts_at >= '2015-01-05 00:00:00.000000' AND punches.ends_at <= '2015-01-05 23:59:59.999999') AND (id != 3) ORDER BY punches.average_time DESC LIMIT 1 [["punchable_id", 1], ["punchable_type", "Article"]]
19509
+  (0.2ms) rollback transaction
19510
+  (0.1ms) begin transaction
19511
+  (0.1ms) SAVEPOINT active_record_1
19512
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.018738"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.018738"]]
19513
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19514
+  (0.2ms) SELECT SUM("punches"."hits") AS sum_id FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? [["punchable_id", 1], ["punchable_type", "Article"]]
19515
+  (0.2ms) rollback transaction
19516
+  (0.1ms) begin transaction
19517
+  (0.1ms) SAVEPOINT active_record_1
19518
+ SQL (0.4ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.025317"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.025317"]]
19519
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19520
+  (0.1ms) SAVEPOINT active_record_1
19521
+ SQL (0.4ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.028874"], ["ends_at", "2015-01-05 21:10:13.028874"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.028874"]]
19522
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19523
+  (0.1ms) SELECT SUM("punches"."hits") AS sum_id FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? [["punchable_id", 1], ["punchable_type", "Article"]]
19524
+  (0.3ms) rollback transaction
19525
+  (0.1ms) begin transaction
19526
+  (0.1ms) SAVEPOINT active_record_1
19527
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.035790"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.035790"]]
19528
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19529
+  (0.1ms) SELECT SUM("punches"."hits") AS sum_id FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? [["punchable_id", 1], ["punchable_type", "Article"]]
19530
+  (0.1ms) SAVEPOINT active_record_1
19531
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.039769"], ["ends_at", "2015-01-05 21:10:13.039769"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.039769"]]
19532
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19533
+  (0.1ms) SELECT SUM("punches"."hits") AS sum_id FROM "punches" WHERE "punches"."punchable_id" = ? AND "punches"."punchable_type" = ? [["punchable_id", 1], ["punchable_type", "Article"]]
19534
+  (0.2ms) rollback transaction
19535
+  (0.1ms) begin transaction
19536
+  (0.1ms) SAVEPOINT active_record_1
19537
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.044801"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.044801"]]
19538
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19539
+  (0.0ms) SAVEPOINT active_record_1
19540
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.046990"], ["ends_at", "2015-01-05 21:10:13.046990"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.046990"]]
19541
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19542
+  (0.0ms) SAVEPOINT active_record_1
19543
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.049236"], ["ends_at", "2015-01-05 21:10:13.049236"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.049236"]]
19544
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19545
+  (0.0ms) SAVEPOINT active_record_1
19546
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.051092"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.051092"]]
19547
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19548
+  (0.0ms) SAVEPOINT active_record_1
19549
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.052775"], ["ends_at", "2015-01-05 21:10:13.052775"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.052775"]]
19550
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19551
+ Article Load (0.4ms) SELECT "articles".* FROM "articles" INNER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "punches"."punchable_type", "punches"."punchable_id", "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 5
19552
+  (0.3ms) rollback transaction
19553
+  (0.1ms) begin transaction
19554
+  (0.1ms) SAVEPOINT active_record_1
19555
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.068194"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.068194"]]
19556
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19557
+  (0.0ms) SAVEPOINT active_record_1
19558
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.070325"], ["ends_at", "2015-01-05 21:10:13.070325"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.070325"]]
19559
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19560
+  (0.0ms) SAVEPOINT active_record_1
19561
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.072563"], ["ends_at", "2015-01-05 21:10:13.072563"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.072563"]]
19562
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19563
+  (0.1ms) SAVEPOINT active_record_1
19564
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.074389"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.074389"]]
19565
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19566
+  (0.1ms) SAVEPOINT active_record_1
19567
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.076117"], ["ends_at", "2015-01-05 21:10:13.076117"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.076117"]]
19568
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19569
+ Article Load (0.3ms) SELECT "articles".* FROM "articles" INNER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "punches"."punchable_type", "punches"."punchable_id", "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 5
19570
+  (0.2ms) rollback transaction
19571
+  (0.1ms) begin transaction
19572
+  (0.0ms) SAVEPOINT active_record_1
19573
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.080702"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.080702"]]
19574
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19575
+  (0.1ms) SAVEPOINT active_record_1
19576
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.082907"], ["ends_at", "2015-01-05 21:10:13.082907"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.082907"]]
19577
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19578
+  (0.0ms) SAVEPOINT active_record_1
19579
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.085236"], ["ends_at", "2015-01-05 21:10:13.085236"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.085236"]]
19580
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19581
+  (0.1ms) SAVEPOINT active_record_1
19582
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.087614"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.087614"]]
19583
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19584
+  (0.1ms) SAVEPOINT active_record_1
19585
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.090420"], ["ends_at", "2015-01-05 21:10:13.090420"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.090420"]]
19586
+  (0.2ms) RELEASE SAVEPOINT active_record_1
19587
+  (0.1ms) SAVEPOINT active_record_1
19588
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "American Apparel aute Banksy officia ugh."], ["created_at", "2015-01-05 21:10:13.093130"], ["title", "Hipsters"], ["updated_at", "2015-01-05 21:10:13.093130"]]
19589
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19590
+ Article Load (0.3ms) SELECT "articles".* FROM "articles" INNER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "punches"."punchable_type", "punches"."punchable_id", "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 5
19591
+  (0.2ms) rollback transaction
19592
+  (0.1ms) begin transaction
19593
+  (0.1ms) SAVEPOINT active_record_1
19594
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.098019"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.098019"]]
19595
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19596
+  (0.0ms) SAVEPOINT active_record_1
19597
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.099855"], ["ends_at", "2015-01-05 21:10:13.099855"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.099855"]]
19598
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19599
+  (0.0ms) SAVEPOINT active_record_1
19600
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.101765"], ["ends_at", "2015-01-05 21:10:13.101765"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.101765"]]
19601
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19602
+  (0.0ms) SAVEPOINT active_record_1
19603
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.103346"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.103346"]]
19604
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19605
+  (0.1ms) SAVEPOINT active_record_1
19606
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.104908"], ["ends_at", "2015-01-05 21:10:13.104908"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.104908"]]
19607
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19608
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" INNER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "punches"."punchable_type", "punches"."punchable_id", "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 1
19609
+  (0.2ms) rollback transaction
19610
+  (0.0ms) begin transaction
19611
+  (0.1ms) SAVEPOINT active_record_1
19612
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.109116"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.109116"]]
19613
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19614
+  (0.1ms) SAVEPOINT active_record_1
19615
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.111183"], ["ends_at", "2015-01-05 21:10:13.111183"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.111183"]]
19616
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19617
+  (0.0ms) SAVEPOINT active_record_1
19618
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.113068"], ["ends_at", "2015-01-05 21:10:13.113068"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.113068"]]
19619
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19620
+  (0.0ms) SAVEPOINT active_record_1
19621
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.114701"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.114701"]]
19622
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19623
+  (0.0ms) SAVEPOINT active_record_1
19624
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.116246"], ["ends_at", "2015-01-05 21:10:13.116246"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.116246"]]
19625
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19626
+ Article Load (0.3ms) SELECT "articles".* FROM "articles" INNER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "punches"."punchable_type", "punches"."punchable_id", "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 1 OFFSET 1
19627
+  (0.3ms) rollback transaction
19628
+  (0.1ms) begin transaction
19629
+  (0.1ms) SAVEPOINT active_record_1
19630
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.123079"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.123079"]]
19631
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19632
+  (0.1ms) SAVEPOINT active_record_1
19633
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.125303"], ["ends_at", "2015-01-05 21:10:13.125303"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.125303"]]
19634
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19635
+  (0.1ms) SAVEPOINT active_record_1
19636
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.127636"], ["ends_at", "2015-01-05 21:10:13.127636"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.127636"]]
19637
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19638
+  (0.0ms) SAVEPOINT active_record_1
19639
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.129273"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.129273"]]
19640
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19641
+  (0.1ms) SAVEPOINT active_record_1
19642
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.130875"], ["ends_at", "2015-01-05 21:10:13.130875"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.130875"]]
19643
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19644
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" LEFT OUTER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "articles"."id" ORDER BY SUM(punches.hits) DESC
19645
+  (0.2ms) rollback transaction
19646
+  (0.1ms) begin transaction
19647
+  (0.1ms) SAVEPOINT active_record_1
19648
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.134779"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.134779"]]
19649
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19650
+  (0.0ms) SAVEPOINT active_record_1
19651
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.136632"], ["ends_at", "2015-01-05 21:10:13.136632"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.136632"]]
19652
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19653
+  (0.1ms) SAVEPOINT active_record_1
19654
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.139719"], ["ends_at", "2015-01-05 21:10:13.139719"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.139719"]]
19655
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19656
+  (0.1ms) SAVEPOINT active_record_1
19657
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.142356"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.142356"]]
19658
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19659
+  (0.1ms) SAVEPOINT active_record_1
19660
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.144794"], ["ends_at", "2015-01-05 21:10:13.144794"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.144794"]]
19661
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19662
+  (0.1ms) SAVEPOINT active_record_1
19663
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "American Apparel aute Banksy officia ugh."], ["created_at", "2015-01-05 21:10:13.147457"], ["title", "Hipsters"], ["updated_at", "2015-01-05 21:10:13.147457"]]
19664
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19665
+ Article Load (0.3ms) SELECT "articles".* FROM "articles" LEFT OUTER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "articles"."id" ORDER BY SUM(punches.hits) DESC
19666
+  (0.4ms) rollback transaction
19667
+  (0.1ms) begin transaction
19668
+  (0.1ms) SAVEPOINT active_record_1
19669
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.154052"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.154052"]]
19670
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19671
+  (0.1ms) SAVEPOINT active_record_1
19672
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.157095"], ["ends_at", "2015-01-05 21:10:13.157095"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.157095"]]
19673
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19674
+  (0.1ms) SAVEPOINT active_record_1
19675
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.159737"], ["ends_at", "2015-01-05 21:10:13.159737"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.159737"]]
19676
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19677
+  (0.0ms) SAVEPOINT active_record_1
19678
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.161826"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.161826"]]
19679
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19680
+  (0.0ms) SAVEPOINT active_record_1
19681
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.163549"], ["ends_at", "2015-01-05 21:10:13.163549"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.163549"]]
19682
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19683
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" LEFT OUTER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "articles"."id" ORDER BY SUM(punches.hits) DESC
19684
+  (0.2ms) rollback transaction
19685
+  (0.1ms) begin transaction
19686
+  (0.0ms) SAVEPOINT active_record_1
19687
+ SQL (0.2ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.167447"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.167447"]]
19688
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19689
+  (0.0ms) SAVEPOINT active_record_1
19690
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.169310"], ["ends_at", "2015-01-05 21:10:13.169310"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.169310"]]
19691
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19692
+  (0.0ms) SAVEPOINT active_record_1
19693
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.171292"], ["ends_at", "2015-01-05 21:10:13.171292"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.171292"]]
19694
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19695
+  (0.0ms) SAVEPOINT active_record_1
19696
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.172871"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.172871"]]
19697
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19698
+  (0.1ms) SAVEPOINT active_record_1
19699
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.174512"], ["ends_at", "2015-01-05 21:10:13.174512"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.174512"]]
19700
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19701
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" LEFT OUTER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 1
19702
+  (0.2ms) rollback transaction
19703
+  (0.1ms) begin transaction
19704
+  (0.1ms) SAVEPOINT active_record_1
19705
+ SQL (0.3ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Lebowski ipsum over the line! Dolor sit amet, consectetur adipiscing elit praesent ac."], ["created_at", "2015-01-05 21:10:13.178676"], ["title", "Lebowski"], ["updated_at", "2015-01-05 21:10:13.178676"]]
19706
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19707
+  (0.1ms) SAVEPOINT active_record_1
19708
+ SQL (0.3ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.181028"], ["ends_at", "2015-01-05 21:10:13.181028"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.181028"]]
19709
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19710
+  (0.1ms) SAVEPOINT active_record_1
19711
+ SQL (0.2ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.183769"], ["ends_at", "2015-01-05 21:10:13.183769"], ["punchable_id", 1], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.183769"]]
19712
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19713
+  (0.1ms) SAVEPOINT active_record_1
19714
+ SQL (0.1ms) INSERT INTO "articles" ("content", "created_at", "title", "updated_at") VALUES (?, ?, ?, ?) [["content", "Bacon ipsum dolor sit amet turkey short ribs tri-tip"], ["created_at", "2015-01-05 21:10:13.185866"], ["title", "Bacon"], ["updated_at", "2015-01-05 21:10:13.185866"]]
19715
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19716
+  (0.1ms) SAVEPOINT active_record_1
19717
+ SQL (0.1ms) INSERT INTO "punches" ("average_time", "ends_at", "punchable_id", "punchable_type", "starts_at") VALUES (?, ?, ?, ?, ?) [["average_time", "2015-01-05 21:10:13.188057"], ["ends_at", "2015-01-05 21:10:13.188057"], ["punchable_id", 2], ["punchable_type", "Article"], ["starts_at", "2015-01-05 21:10:13.188057"]]
19718
+  (0.1ms) RELEASE SAVEPOINT active_record_1
19719
+ Article Load (0.2ms) SELECT "articles".* FROM "articles" LEFT OUTER JOIN "punches" ON "punches"."punchable_id" = "articles"."id" AND "punches"."punchable_type" = 'Article' GROUP BY "articles"."id" ORDER BY SUM(punches.hits) DESC LIMIT 1 OFFSET 1
19720
+  (0.2ms) rollback transaction
@@ -104,16 +104,4 @@ describe Punch do
104
104
  end
105
105
  end
106
106
  end
107
-
108
- describe '.combine_by' do
109
- let(:combine_by) { -> { Punch.combine_by(:day, article) } }
110
-
111
- context 'with one punch' do
112
- let!(:punch) { Punch.create punchable: article }
113
-
114
- it 'does nothing' do
115
- expect { combine_by.call }.to_not change { punch }
116
- end
117
- end
118
- end
119
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: punching_bag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Crownoble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2015-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -174,4 +174,3 @@ test_files:
174
174
  - spec/internal/config/database.yml
175
175
  - spec/internal/app/models/article.rb
176
176
  - spec/internal/log/test.log
177
- has_rdoc: