docbrown/app/models
Jeremy Friesen fe2e53cc50
Moving Experiments into AbExperiment namespace (#17532)
* Moving Experiments into AbExperiment namespace

This commit entails two major concepts:

1. Extracting logic out of a worker.
2. Cleaning the conditions in which we convert experiments.

In addition, I revisited some spec names to tidy them up for
clarification and structure.

**Extracting Logic...**

For workers, my preference is that they be a simple router to another
object.  A non-worker object, with it's initialize method, can both
better manage instance variables.  Further, workers are somewhat "flat"
in hierarchy,

In this case, having the AbExperiment be knowledgeable both in setting
the experiment and handling conversions makes (to me) organizational
sense.  For example, the AbExperiment is constructed as a wrapper to the
FieldTest gem.  But the RecordFieldTestEventWorker had knowledge of
FieldTest.

With this refactor, it does not have that knowledge.  This also provided
an opportunity to replace magic strings with constants.

**Cleaning the conditions...**

This relates directly to and closes forem/forem#17530.  I was looking at
the experiments after 2 days, and realized that there shouldn't be
results for
`user_views_pages_on_at_least_nine_different_days_within_two_weeks`;
after all the experiment started 2 days ago, how can we have results
that look at 2 weeks.

By adding the "max" function calls, we ensure a clear boundary of
"before the experiment began" versus "while the experiment is running".

Closes forem/forem#17530

* Update spec/models/ab_experiment_spec.rb

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Apply suggestions from code review

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-05-03 21:34:12 -04:00
..
ab_experiment Moving Experiments into AbExperiment namespace (#17532) 2022-05-03 21:34:12 -04:00
ahoy Favoring delete_all on user relationships (#15443) 2021-11-23 11:50:12 -05:00
articles Updating documentation for the relevancy feed (#17503) 2022-04-29 09:50:05 -04:00
concerns Remove CustomProfileField (#14286) 2021-07-22 10:05:39 +07:00
liquid_tags
settings Remove sustaining member newsletter, and its settings (#17514) 2022-04-29 11:47:12 -05:00
users Remove GDPR from the "users" namespace (#17536) 2022-05-03 19:42:20 +02:00
ab_experiment.rb Moving Experiments into AbExperiment namespace (#17532) 2022-05-03 21:34:12 -04:00
admin_menu.rb Removing conditional for AdminMenu's spaces (#17162) 2022-04-28 08:49:59 -04:00
announcement.rb
api_secret.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
application_record.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
article.rb Update sort to have nulls at last (#17317) 2022-04-21 12:25:39 -04:00
async_info.rb Encapsulating the "why we hide/show" something (#17166) 2022-04-11 13:40:16 -04:00
audit_log.rb Favoring constant over magic string (#15852) 2021-12-27 11:31:29 -05:00
badge.rb Refactor cache purging (#12811) 2021-03-02 10:09:05 -05:00
badge_achievement.rb Extracting container for allowed tags & attrs (#15338) 2021-12-16 12:24:45 -05:00
banished_user.rb
broadcast.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
campaign.rb [Small win] Add display name to campaign settings (#16653) 2022-02-22 10:01:52 -05:00
collection.rb Series count to only include non empty series (#16130) 2022-01-18 10:22:34 +07:00
comment.rb Moving Experiments into AbExperiment namespace (#17532) 2022-05-03 21:34:12 -04:00
config.rb
consumer_app.rb Fixes a name conflict in Rpush models (#15978) 2022-01-07 09:38:16 -06:00
context_notification.rb Context Notifications (#17243) 2022-04-18 10:30:30 +03:00
creator_setting.rb Creator Onboarding: Creator Setup View (#14728) 2021-11-01 15:50:08 -04:00
credit.rb Favor repurposing existing scope (#15914) 2022-01-03 09:30:34 -05:00
data_update_script.rb Navigation Items and Role access for Data Update Scripts (#12292) 2021-02-09 17:41:14 +02:00
device.rb Spelling (#15702) 2021-12-07 06:59:10 -07:00
discussion_lock.rb Renaming method for clarity (#16791) 2022-03-07 12:55:56 -05:00
display_ad.rb Extracting container for allowed tags & attrs (#15338) 2021-12-16 12:24:45 -05:00
display_ad_event.rb Extracting constants and tidying tests (#15946) 2022-01-05 09:19:39 -05:00
email_authorization.rb Refactor Admin Member Detail view - Tools section (#14283) 2021-08-17 18:55:53 +02:00
email_message.rb Delete old retained emails after certain period (#14949) 2021-10-12 16:27:13 -04:00
extension.rb Introduce "extensions" (#16840) 2022-03-18 11:22:17 +02:00
feedback_message.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
follow.rb Refactoring cached_followed_tags (#16175) 2022-01-24 19:53:48 -05:00
forem_instance.rb "Reply to" and "From" Email addresses for SMTP Configurations (#16499) 2022-02-16 16:14:54 +02:00
gdpr_delete_request.rb Remove GDPR from the "users" namespace (#17536) 2022-05-03 19:42:20 +02:00
github_issue.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
github_repo.rb POC: use Sidekiq.perform_bulk for Github repos (#16293) 2022-01-26 09:11:07 +07:00
html_variant.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
html_variant_success.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
html_variant_trial.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
identity.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
invitation.rb
listing.rb Conditionally disabling Listings (Waiting on Product but technically Good to Go) (#16437) 2022-04-11 20:23:56 -04:00
listing_category.rb [deploy] Manage listing categories in dashboard (#10506) 2020-10-02 11:05:09 -04:00
mention.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
mod.rb
moderator_action.rb
navigation_link.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
note.rb Favoring delete_all on user relationships (#15443) 2021-11-23 11:50:12 -05:00
notification.rb Ensure arguments to perform_async are json safe (#16285) 2022-01-25 18:07:40 -06:00
notification_subscription.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
organization.rb Ensuring article's cache updates on org image update (#17052) 2022-04-01 10:54:55 -04:00
organization_membership.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
overview.rb Add admin overview page (#12726) 2021-03-01 18:59:05 -06:00
page.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
page_view.rb Moving Experiments into AbExperiment namespace (#17532) 2022-05-03 21:34:12 -04:00
permission.rb
pinned_article.rb Pin posts to feed (#13807) 2021-06-04 10:54:53 +02:00
podcast.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
podcast_episode.rb Various cleanups (#14616) 2021-08-31 09:17:24 +07:00
podcast_episode_appearance.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
podcast_ownership.rb Appeasing Rubocop as it sneaks some changes in (#16085) 2022-01-13 07:48:01 -05:00
poll.rb Refactoring poll/vote/skip logic (#15441) 2021-11-29 10:52:32 -05:00
poll_option.rb Favoring dependent: :delete_all over :destroy (#15442) 2021-11-24 13:56:16 -05:00
poll_skip.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
poll_vote.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
privileged_reaction.rb
profile.rb Profile attribute names should be unique and non-empty (#16396) 2022-04-04 12:14:02 -05:00
profile_field.rb Profile attribute names should be unique and non-empty (#16396) 2022-04-04 12:14:02 -05:00
profile_field_group.rb [deploy] /profile/settings page rendering (Ridhwana/Michael) (#10733) 2020-10-20 09:18:13 -04:00
profile_pin.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
rating_vote.rb Removing deprecated User methods (#16435) 2022-02-07 10:32:58 -05:00
reaction.rb Don't send notification for invalid reactions (#16721) 2022-02-28 12:36:44 -06:00
response_template.rb Removing deprecated User methods (#16435) 2022-02-07 10:32:58 -05:00
role.rb ✂✂✂ Remove Connect (#14734) 2021-11-18 08:21:00 -06:00
secret.rb
space.rb Busting tag cache when space changes (#17384) 2022-04-20 16:37:34 -04:00
sponsorship.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
tag.rb Renaming method for clarity (#16791) 2022-03-07 12:55:56 -05:00
tag_adjustment.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
timeframe.rb Remove timeframer from app/labor (#11782) 2020-12-08 12:52:33 +07:00
tool.rb
tweet.rb Better error upon Tweet embed when Twitter keys missing (#16916) 2022-03-21 16:21:37 -04:00
user.rb Remove sustaining member newsletter, and its settings (#17514) 2022-04-29 11:47:12 -05:00
user_block.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
user_role.rb [Search 2.0] Users (#13453) 2021-04-24 19:06:06 +02:00
user_subscription.rb app/models i18n (#16124) 2022-02-03 13:41:42 -05:00
welcome.rb
welcome_notification.rb