Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #81 from botmetrics/path-analysis-tweaks
Browse files Browse the repository at this point in the history
Path analysis tweaks
  • Loading branch information
arunthampi authored Jan 4, 2017
2 parents cb88117 + b7e861e commit d31b0fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/pages/funnels/funnel.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class App.Funnel
if steps == 0
"#{numUsers} use#{if numUsers == 1 then 'r' else 'rs'} performed the next action immediately"
else
"#{numUsers} use#{if numUsers == 1 then 'r' else 'rs'} went through #{steps} ste#{if steps == 1 then 'p' else 'ps'} before the next action"
"#{numUsers} use#{if numUsers == 1 then 'r' else 'rs'} interacted #{steps} tim#{if steps == 1 then 'e' else 'es'} before the next action"

legend:
display: false
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/paths_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ module PathsHelper
def formatted_event(event)
case event.event_type
when 'user-added' then 'User Signed Up'
when 'message'
when 'message', 'message:image-uploaded', 'message:link-uploaded', 'message:location-sent', 'message:video-uploaded'
if (attachments = event.event_attributes['attachments']).present?
"Message with Attachments: <code>#{attachments}</code>"
else
event.text.to_s
end
when 'messaging_postbacks' then "Clicked Button with payload: <code>#{event.event_attributes['payload']}</code>"
else ''
end
end
end
4 changes: 2 additions & 2 deletions app/views/paths/insights.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.secondary-menu.row
.col-md-7.col-sm-9.col-xs-6
.col-md-10.col-sm-10.col-xs-10
= link_to bot_paths_path(@bot), class: 'breadcrumb' do
%h2 All Paths
%span.breadcrumb-separator
Expand All @@ -11,7 +11,7 @@
%h2
Path Analysis

.col-md-5.col-sm-3.col-xs-6.text-right
.col-md-2.col-sm-2.col-xs-2.text-right
#report-range.pull-right
= icon('calendar')
%span
Expand Down
16 changes: 8 additions & 8 deletions spec/models/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,24 @@
describe 'group_by is "this-week"' do
before do
dashboard.group_by = 'this-week'
now = Time.now
# This date is a Monday so makes sure that everything works accordingly
Timecop.freeze(2016, 8, 22, 10, 0, 0)
@now = Time.now
end

after do
Timecop.return
end

describe 'bots-installed' do
let!(:i1) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: Time.now }
let!(:i2) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: Time.now - 1.hour }
let!(:i1) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now }
let!(:i2) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now - 1.hour }
# i3-i5 is Sunday
let!(:i3) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: 1.day.ago }
let!(:i4) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: 1.day.ago - 1.hour }
let!(:i5) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: 1.day.ago - 2.hours }
let!(:i6) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: 2.weeks.ago }
let!(:i7) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: 2.weeks.ago - 1.hour }
let!(:i3) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now - 1.day }
let!(:i4) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now - 1.day - 1.hour }
let!(:i5) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now - 1.day - 2.hours }
let!(:i6) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now - 2.weeks }
let!(:i7) { create :bot_instance, :with_attributes, uid: SecureRandom.hex(8), bot: bot, state: 'enabled', created_at: @now - 2.weeks - 1.hour }
let!(:i9) { create :bot_instance }

let!(:e1) { create :rolledup_event, count: 1, dashboard: dashboard, bot_instance: i1, created_at: i1.created_at }
Expand Down

0 comments on commit d31b0fe

Please sign in to comment.