Add A/B/n test for interventions
This commit is contained in:
35
lib/user_group_separator.rb
Normal file
35
lib/user_group_separator.rb
Normal file
@ -0,0 +1,35 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class UserGroupSeparator
|
||||
# Different user groups for the Java21 course based on the user_id
|
||||
# 0: show_tips_intervention && no_b
|
||||
# 1: show_break_intervention && no_b
|
||||
# 2: show_rfc_intervention && no_b
|
||||
# 3: show_tips_intervention && show_b
|
||||
# 4: show_break_intervention && show_b
|
||||
# 5: show_rfc_intervention && show_b
|
||||
|
||||
# separates user into 33% tips interventions, 33% break intervention, 33% rfc intervention
|
||||
def self.get_intervention_group(user_id)
|
||||
user_group = user_id % 6 # => 0, 1, 2, 3, 4, 5
|
||||
case user_group
|
||||
when 0, 3
|
||||
:show_tips_intervention
|
||||
when 1, 4
|
||||
:show_break_intervention
|
||||
else # 2, 5
|
||||
:show_rfc_intervention
|
||||
end
|
||||
end
|
||||
|
||||
# separates user into 50% with Community Solution, 50% without Community Solution
|
||||
def self.get_community_solution_group(user_id)
|
||||
user_group = user_id % 6 # => 0, 1, 2, 3, 4, 5
|
||||
case user_group
|
||||
when 0, 1, 2
|
||||
:show_community_solution
|
||||
else # 3, 4, 5
|
||||
:no_community_solution
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user