conductor 0.5.15 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -11,7 +11,9 @@ begin
11
11
  gem.homepage = "http://github.com/noctivityinc/conductor"
12
12
  gem.authors = ["Noctivity"]
13
13
  gem.rubyforge_project = "conductor"
14
- gem.files = FileList["[A-Z]*", "{generators,lib}/**/*", "init.rb"]
14
+ gem.files = FileList["[A-Z]*", "{generators,lib,tasks}/**/*", "init.rb"]
15
+ gem.add_dependency 'googlecharts'
16
+ gem.add_dependency 'haml'
15
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
18
  end
17
19
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.15
1
+ 0.6.3
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ class ConductorGenerator < Rails::Generator::Base
4
+
5
+ def initialize(*runtime_args)
6
+ super
7
+ end
8
+
9
+ def manifest
10
+ record do |m|
11
+ m.directory File.join('lib', 'tasks')
12
+ m.template 'conductor.rake', File.join('lib', 'tasks', 'conductor.rake')
13
+
14
+ m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "conductor_migration"
15
+
16
+ m.directory File.join('public', 'stylesheets')
17
+ m.template 'conductor.css', File.join('public', 'stylesheets', 'conductor.css')
18
+ end
19
+ end
20
+
21
+ protected
22
+
23
+ def banner
24
+ %{Usage: #{$0} #{spec.name}\nCopies conductor.rake to lib/tasks. Copies migration file to db/migrate. Copies conductor.css to public/stylesheets/}
25
+ end
26
+
27
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ namespace :conductor do
2
+ desc "Rolls-up raw data into the daily conductor model for use in weights"
3
+ task :rollup do
4
+ Conductor::Rollup.process
5
+ end
6
+ end
data/lib/conductor.rb CHANGED
@@ -6,6 +6,8 @@ require 'conductor/experiment/daily'
6
6
  require 'conductor/experiment/weight'
7
7
  require 'conductor/experiment/history'
8
8
  require 'conductor/controller/dashboard'
9
+ require 'conductor/helpers/dashboard_helper'
10
+
9
11
 
10
12
  class Conductor
11
13
  MAX_WEIGHTING_FACTOR = 1.25
@@ -0,0 +1,69 @@
1
+ module DashboardHelper
2
+ def current_weights(group_name, group)
3
+ total = group.inject(0) {|res, x| res += x.weight}
4
+ data = []
5
+ legend = []
6
+ group.each do |x|
7
+ legend << "#{x.alternative} (#{"%0.2f" % (x.weight.to_f/total.to_f*100)}%)"
8
+ data << x.weight
9
+ end
10
+ return Gchart.pie(:data => data, :legend => legend, :size => '600x200')
11
+ end
12
+
13
+ def daily_stats(group_name, group)
14
+ data = []
15
+ legend = []
16
+ colors = []
17
+ group.group_by(&:alternative).map do |alternative, rows|
18
+ legend << alternative
19
+ data << rows.sort_by(&:activity_date).map(&:views)
20
+ colors << random_color
21
+ end
22
+
23
+ min_value = group.min {|a,b| a.views <=> b.views }.views
24
+ max_value = group.max {|a,b| a.views <=> b.views }.views
25
+ dr = group.min {|a,b| a.activity_date <=> b.activity_date }.activity_date..group.max {|a,b| a.activity_date <=> b.activity_date }.activity_date
26
+
27
+ return Gchart.line(:size => '600x250',
28
+ :title => group_name,
29
+ :legend => legend,
30
+ :data => data,
31
+ :axis_with_labels => ['x','y'],
32
+ :axis_labels => [dr.step(3).map {|x| x},(min_value..max_value).step(10).map {|x| x}],
33
+ :line_colors => colors)
34
+ end
35
+
36
+ def weight_history(group_name, group)
37
+ data = []
38
+ legend = []
39
+ colors = []
40
+ group.group_by(&:alternative).each do |alternative, rows|
41
+ legend << alternative
42
+ data << rows.sort_by(&:computed_at).map(&:weight)
43
+ colors << random_color
44
+ end
45
+
46
+ min_value = group.min {|a,b| a.weight <=> b.weight }.weight
47
+ max_value = group.max {|a,b| a.weight <=> b.weight }.weight
48
+ dr = group.min {|a,b| a.computed_at <=> b.computed_at}.computed_at.to_date..group.max {|a,b| a.computed_at <=> b.computed_at }.computed_at.to_date
49
+
50
+ return Gchart.line(:size => '700x350',
51
+ :title => group_name,
52
+ :legend => legend,
53
+ :data => data,
54
+ :axis_with_labels => ['x','y'],
55
+ :axis_labels => [dr.step(1).map {|x| x},(min_value..max_value).step(10).map {|x| x}],
56
+ :line_colors => colors,
57
+ :encoding => 'extended')
58
+ end
59
+
60
+
61
+ # Method to select a random color from a list of hex codes
62
+ #
63
+ # Example: random_color()
64
+ # => "ff0000"
65
+ def random_color()
66
+ color_list = %w{000000 0000ff ff0000 ffff00 00ffff ff00ff 00ff00}
67
+ return color_list[rand(color_list.size)]
68
+ end
69
+ end
@@ -1,58 +1,70 @@
1
- #conductor_dashboard
2
- #weights
3
- %h2 Current Experiment Weights
4
- - @weights.group_by(&:group_name).each do |group_name, group|
5
- .group
6
- %fieldset
7
- %legend= group_name
8
- %table
9
- %tr
10
- %th Alternative
11
- %th Weight
12
- - group.each do |row|
13
- %tr
14
- %td.name= row.alternative
15
- %td.weight= row.weight
1
+ !!!
2
+ %html{ :xmlns => "http://www.w3.org/1999/xhtml" }
3
+ %head
4
+ %meta{ :content => "text/html; charset=utf-8", "http-equiv" => "Content-Type" }
5
+ %title
6
+ = h(yield(:title) || "Conductor Statistic as of #{Time.now}")
7
+ = stylesheet_link_tag 'conductor', :media => "all"
8
+ %body
9
+ #conductor_dashboard
10
+ #weights
11
+ %h2 Current Experiment Weights
12
+ - @weights.group_by(&:group_name).each do |group_name, group|
13
+ .group
14
+ %fieldset
15
+ %legend= group_name
16
+ = image_tag current_weights(group_name, group)
17
+ %table
18
+ %tr
19
+ %th Alternative
20
+ %th Weight
21
+ - group.each do |row|
22
+ %tr
23
+ %td.name= row.alternative
24
+ %td.weight= row.weight
16
25
 
17
- #dailies
18
- %h2 Experiment Statistics
19
- - @dailies.group_by(&:group_name).each do |group_name, group|
20
- .group
21
- %fieldset
22
- %legend= group_name
23
- %table
24
- %tr
25
- %th Date
26
- %th Alternative
27
- %th Views
28
- %th Conversions
29
- %th Value
30
- - group.sort_by(&:activity_date).reverse.each do |row|
31
- %tr
32
- %td.date= row.activity_date
33
- %td.name= row.alternative
34
- %td.views= row.views
35
- %td.conversions= row.conversions
36
- %td.value= row.conversion_value
26
+ #dailies
27
+ %h2 Experiment Statistics
28
+ - @dailies.group_by(&:group_name).each do |group_name, group|
29
+ .group
30
+ %fieldset
31
+ %legend= group_name
32
+ .chart
33
+ = image_tag daily_stats(group_name, group)
34
+ %table
35
+ %tr
36
+ %th Date
37
+ %th Alternative
38
+ %th Views
39
+ %th Conversions
40
+ %th Value
41
+ - group.sort_by(&:activity_date).reverse.each do |row|
42
+ %tr
43
+ %td.date= row.activity_date
44
+ %td.name= row.alternative
45
+ %td.views= row.views
46
+ %td.conversions= row.conversions
47
+ %td.value= row.conversion_value
37
48
 
38
- #history
39
- %h2 Experiment Weight History
40
- - @weight_history.group_by(&:group_name).each do |group_name, group|
41
- .group
42
- %fieldset
43
- %legend= group_name
44
- %table
45
- %tr
46
- %th Date
47
- %th Alternative
48
- %th Weight
49
- - group.sort_by(&:computed_at).reverse.each do |row|
50
- %tr
51
- %td.date
52
- = row.computed_at
53
- - if row.launch_window
54
- = "(#{row.launch_window} day(s) till hard launch)"
55
- %td.name= row.alternative
56
- %td.weight= row.weight
49
+ #history
50
+ %h2 Experiment Weight History
51
+ - @weight_history.group_by(&:group_name).each do |group_name, group|
52
+ .group
53
+ %fieldset
54
+ %legend= group_name
55
+ = image_tag weight_history(group_name, group)
56
+ %table
57
+ %tr
58
+ %th Date
59
+ %th Alternative
60
+ %th Weight
61
+ - group.sort_by(&:computed_at).reverse.each do |row|
62
+ %tr
63
+ %td.date
64
+ = row.computed_at
65
+ - if row.launch_window
66
+ = "(#{row.launch_window} day(s) till hard launch)"
67
+ %td.name= row.alternative
68
+ %td.weight= row.weight
57
69
 
58
70
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
8
- - 15
9
- version: 0.5.15
7
+ - 6
8
+ - 3
9
+ version: 0.6.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Noctivity
@@ -14,10 +14,35 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-30 00:00:00 -04:00
17
+ date: 2010-10-01 00:00:00 -04:00
18
18
  default_executable:
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: googlecharts
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: haml
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
21
46
  description: Conductor is the bastard child of a/b testing and personalization. It throws everything you know about creating a web site our the window and lets you just "try stuff" without ever having to worry about not maximing your site's "purpose." Have a new landing page? Just throw it to the conductor. Want to try different price points - conductor. Different form designs? Conductor. Conductor will rotate all alternatives through the mix and eventually settle on the top performing of all, without you having to do anything other than just creating. Think "intelligent A/B testing" on steriods.
22
47
  email: jlippiner@noctivity.com
23
48
  executables: []
@@ -32,8 +57,10 @@ files:
32
57
  - README.rdoc
33
58
  - Rakefile
34
59
  - VERSION
35
- - generators/conductor_migration/conductor_migration_generator.rb
36
- - generators/conductor_migration/templates/migration.rb
60
+ - generators/conductor/conductor_generator.rb
61
+ - generators/conductor/templates/conductor.css
62
+ - generators/conductor/templates/conductor.rake
63
+ - generators/conductor/templates/migration.rb
37
64
  - init.rb
38
65
  - lib/conductor.rb
39
66
  - lib/conductor/controller/dashboard.rb
@@ -42,6 +69,7 @@ files:
42
69
  - lib/conductor/experiment/history.rb
43
70
  - lib/conductor/experiment/raw.rb
44
71
  - lib/conductor/experiment/weight.rb
72
+ - lib/conductor/helpers/dashboard_helper.rb
45
73
  - lib/conductor/roll_up.rb
46
74
  - lib/conductor/views/dashboard/index.html.haml
47
75
  - lib/conductor/weights.rb
@@ -1,9 +0,0 @@
1
- class ConductorMigrationGenerator < Rails::Generator::Base
2
- require 'conductor'
3
-
4
- def manifest
5
- record do |m|
6
- m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "conductor_migration"
7
- end
8
- end
9
- end