debian-mirror-gitlab/app/helpers/count_helper.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
922 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2018-10-15 14:42:47 +05:30
module CountHelper
2018-11-08 19:23:39 +05:30
def approximate_count_with_delimiters(count_data, model)
count = count_data[model]
raise "Missing model #{model} from count data" unless count
number_with_delimiter(count)
2018-10-15 14:42:47 +05:30
end
2018-12-13 13:39:08 +05:30
# 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.
#
2019-07-07 11:18:12 +05:30
# This makes querying this information a lot more efficient and it should be
2018-12-13 13:39:08 +05:30
# 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
2018-10-15 14:42:47 +05:30
end