Skip to content

Commit

Permalink
New active discussion tests (forem#21171)
Browse files Browse the repository at this point in the history
  • Loading branch information
benhalpern authored Jul 3, 2024
1 parent 359bb9d commit 2be2590
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/controllers/sidebars_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ def get_active_discussions
tag_names = current_user.cached_followed_tag_names
languages = current_user.languages.pluck(:language)
languages = [I18n.default_locale.to_s] if languages.empty?
order_variant = field_test(:active_discussion_ordering_06_24, participant: @user)
order_variant = field_test(:active_discussion_ordering_07_03, participant: @user)
order = case order_variant
when "base"
Arel.sql("last_comment_at DESC")
when "last_comment_plus_comment_score"
Arel.sql("last_comment_at + (INTERVAL '1 minute' * comment_score) DESC")
when "last_comment_plus_comment_score_capped"
Arel.sql("last_comment_at + (INTERVAL '1 minute' * LEAST(comment_score, 100)) DESC")
when "last_comment_plus_comment_score_double"
Arel.sql("last_comment_at + (INTERVAL '2 minute' * comment_score) DESC")
when "last_comment_plus_comment_score_double_capped"
Arel.sql("last_comment_at + (INTERVAL '2 minute' * LEAST(comment_score, 100)) DESC")
when "last_comment_plus_comment_score_capped_25"
Arel.sql("last_comment_at + (INTERVAL '1 minute' * LEAST(comment_score, 25)) DESC")
when "last_comment_plus_comment_score_capped_50"
Arel.sql("last_comment_at + (INTERVAL '1 minute' * LEAST(comment_score, 50)) DESC")
when "last_comment_plus_comment_score_capped_80"
Arel.sql("last_comment_at + (INTERVAL '1 minute' * LEAST(comment_score, 80)) DESC")
when "last_comment_plus_comment_score_capped_120"
Arel.sql("last_comment_at + (INTERVAL '1 minute' * LEAST(comment_score, 120)) DESC")
else
Arel.sql("last_comment_at DESC")
Arel.sql("last_comment_at + (INTERVAL '1 minute' * LEAST(comment_score, 100)) DESC")
end
@active_discussions = Article.published
.where("published_at > ?", 1.week.ago)
Expand Down
23 changes: 23 additions & 0 deletions config/field_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@
################################################################################

experiments:
active_discussion_ordering_07_03:
started_at: 2024-07-03
variants:
- base
- last_comment_plus_comment_score_capped_25
- last_comment_plus_comment_score_capped_50
- last_comment_plus_comment_score_capped_80
- last_comment_plus_comment_score_capped_120
weights:
- 60
- 12
- 12
- 8
- 8
goals:
- user_creates_pageview
- user_creates_article_reaction
- user_creates_comment
- user_views_pages_on_at_least_two_different_days_within_a_week
- user_views_pages_on_at_least_four_different_days_within_a_week

digest_article_ordering_06_25:
started_at: 2024-06-25
variants:
Expand All @@ -47,6 +68,8 @@ experiments:
- user_views_pages_on_at_least_four_different_days_within_a_week
active_discussion_ordering_06_24:
started_at: 2024-06-24
ended_at: 2024-07-03
winner: last_comment_plus_comment_score_capped
variants:
- base
- last_comment_plus_comment_score
Expand Down

0 comments on commit 2be2590

Please sign in to comment.