2021-04-22 08:09:49 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-02-10 10:12:42 -05:00
|
|
|
class EmptyRepoUploadExperiment < ApplicationExperiment
|
2021-04-22 08:09:49 -04:00
|
|
|
include ProjectCommitCount
|
|
|
|
|
|
|
|
TRACKING_START_DATE = DateTime.parse('2021/4/20')
|
|
|
|
INITIAL_COMMIT_COUNT = 1
|
|
|
|
|
|
|
|
def track_initial_write
|
|
|
|
return unless should_track? # early return if we don't need to ask for commit counts
|
|
|
|
return unless context.project.created_at > TRACKING_START_DATE # early return for older projects
|
|
|
|
return unless commit_count == INITIAL_COMMIT_COUNT
|
|
|
|
|
|
|
|
track(:initial_write, project: context.project)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def commit_count
|
|
|
|
commit_count_for(context.project, max_count: INITIAL_COMMIT_COUNT, experiment: name)
|
|
|
|
end
|
|
|
|
end
|