shrew 0.0.5 → 0.0.6

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: 0228490d8f2957112d12be6b77fdb222753199bf
4
- data.tar.gz: 3b3a5b18b39068b37bc3fd14a2a345277014e3ff
3
+ metadata.gz: 6c193d8007187da9bf64f9a04b122531c66f4275
4
+ data.tar.gz: a497bf8cbd97ce74fe0111f839b3120fffe17243
5
5
  SHA512:
6
- metadata.gz: 72e28bd7b3dc040b0fac7514eb53c4e97aac34843e9aba33b348eae07fdfdb56fa736fec818985a741b7757b72b8876f8505d93a3f39854cb7abd5869d67cf63
7
- data.tar.gz: d90ca96186e29caa84500055d2cf6c87f78c66de7c00938486652bc94f3a5806fb7e83de7069a791242b76a07208f34ae08f3a897cc1745b4b493bd5659a0ba0
6
+ metadata.gz: af19ab6da9fa443bd3186cde3b68541aec22eec968ff8eb14fa74b7d28fbda79e6db2c0a472b3d3c4e2cbea8b504c7d00ff55c25d87b2e33e29f36ba1ceefe16
7
+ data.tar.gz: 296082a0b4308bf8077bb6daa4dde2119d05dc27913c7c6937b6711720bc0a6d70b7915aff917c6eb021f86e2f3e14599fc2fcff1ac0c9a0959908b4f1ed810b
@@ -7,7 +7,6 @@ module Shrew
7
7
  empty_response && return unless page_view
8
8
 
9
9
  page_view.js_return_time = params[:jRT]
10
- page_view.time_between_sent_and_return = page_view.js_return_time - page_view.sent_time if page_view.js_return_time && page_view.sent_time
11
10
  page_view.save
12
11
 
13
12
  empty_response
@@ -6,7 +6,8 @@ module Shrew
6
6
  def self.create_from_payload(payload)
7
7
  attributes = payload.slice(:user_id, :controller, :status, :view_runtime,
8
8
  :db_runtime, :sent_time, :js_return_time,
9
- :js_tracking_id, :action, :path)
9
+ :js_tracking_id, :action, :path, :start_time,
10
+ :duration)
10
11
  .merge(sent_time: milliseconds_since_epoch)
11
12
  create(attributes)
12
13
  end
@@ -6,14 +6,16 @@ class AddShrewPageViewTable < ActiveRecord::Migration
6
6
  t.string :action
7
7
  t.string :path
8
8
  t.integer :status
9
+ t.integer :start_time
10
+ t.integer :duration
9
11
  t.float :view_runtime
10
12
  t.float :db_runtime
11
13
  t.integer :sent_time
12
14
  t.integer :js_return_time
13
- t.integer :time_between_sent_and_return
14
15
  t.binary :js_tracking_id, limit: 16
15
16
  end
16
17
 
17
18
  add_index :shrew_page_views, :user_id
19
+ add_index :shrew_page_views, :js_tracking_id
18
20
  end
19
21
  end
@@ -6,14 +6,16 @@ class AddShrewPageViewTable < ActiveRecord::Migration
6
6
  t.string :action
7
7
  t.string :path
8
8
  t.integer :status
9
+ t.integer :start_time
10
+ t.integer :duration
9
11
  t.float :view_runtime
10
12
  t.float :db_runtime
11
13
  t.integer :sent_time
12
14
  t.integer :js_return_time
13
- t.integer :time_between_sent_and_return
14
15
  t.binary :js_tracking_id, limit: 16
15
16
  end
16
17
 
17
18
  add_index :shrew_page_views, :user_id
19
+ add_index :shrew_page_views, :js_tracking_id
18
20
  end
19
21
  end
data/lib/shrew/engine.rb CHANGED
@@ -6,6 +6,8 @@ module Shrew
6
6
 
7
7
  duration = (finish - start) * 1000
8
8
  payload[:duration] = duration
9
+
10
+ payload[:start_time] = (start.to_f * 1000).to_i
9
11
  next if payload[:controller] == 'Shrew::PageViewsController'
10
12
  Shrew::PageView.create_from_payload(payload)
11
13
  end
@@ -5,7 +5,6 @@ module Shrew
5
5
  def append_info_to_payload(payload)
6
6
  super
7
7
  return unless @_tracking_page_views
8
- p payload.inspect
9
8
  payload[:user_id] = try(:current_user).try(:id)
10
9
  payload[:js_tracking_id] = @_js_tracking_id
11
10
  end
data/lib/shrew/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Shrew
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Gross