diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-08-31 19:16:34 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-10-19 11:57:20 +0200 |
commit | f3fba178b931cd2ba67f81ee667893cb84e7d42f (patch) | |
tree | 24c5a688880d5edd75642a7f16623124bde9fc22 /app/helpers/count_helper.rb | |
parent | 4321d70d24a6a7dc99f80fa4211ba6250504d99b (diff) | |
download | gitlab-ce-f3fba178b931cd2ba67f81ee667893cb84e7d42f.tar.gz |
Remove the `ForkedProjectLink` model
This removes the `ForkedProjectLink` model that has been replaced by
the `ForkNetworkMember` and `ForkNetwork` combination. All existing
relations have been adjusted to use these new models.
The `forked_project_link` table has been dropped.
The "Forks" count on the admin dashboard has been updated to count all
`ForkNetworkMember` rows and deduct the number of `ForkNetwork`
rows. This is because now the "root-project" of a fork network also
has a `ForkNetworkMember` row. This count could become inaccurate when
the root of a fork network is deleted.
Diffstat (limited to 'app/helpers/count_helper.rb')
-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 |