diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-19 11:01:44 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-10-19 11:01:44 +0000 |
commit | ffc505d2170fff93607e37f3a634984b90549436 (patch) | |
tree | 62c9cd0a044b226dae32fcb9ad61cfb5bba8ee07 /app/helpers | |
parent | e2b8337f12a45219548c37287e3929e751e4704d (diff) | |
parent | f3fba178b931cd2ba67f81ee667893cb84e7d42f (diff) | |
download | gitlab-ce-ffc505d2170fff93607e37f3a634984b90549436.tar.gz |
Merge branch 'bvl-remove-forked-project-link' into 'master'
Remove ForkedProjectLink model
Closes #38883
See merge request gitlab-org/gitlab-ce!22226
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/count_helper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/helpers/count_helper.rb b/app/helpers/count_helper.rb index e16223a82c9..13839474e1f 100644 --- a/app/helpers/count_helper.rb +++ b/app/helpers/count_helper.rb @@ -8,4 +8,18 @@ module CountHelper number_with_delimiter(count) end + + # This will approximate the fork count by checking all counting all fork network + # memberships, and deducting 1 for each root of the fork network. + # This might be inacurate as the root of the fork network might have been deleted. + # + # This makes querying this information a lot more effecient and it should be + # accurate enough for the instance wide statistics + def approximate_fork_count_with_delimiters(count_data) + fork_network_count = count_data[ForkNetwork] + fork_network_member_count = count_data[ForkNetworkMember] + approximate_fork_count = fork_network_member_count - fork_network_count + + number_with_delimiter(approximate_fork_count) + end end |