2018-08-18 07:19:57 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-16 02:06:55 -04:00
|
|
|
module CountHelper
|
2018-05-25 17:28:16 -04:00
|
|
|
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-05-16 02:06:55 -04:00
|
|
|
end
|
2018-08-31 13:16:34 -04:00
|
|
|
|
|
|
|
# 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-02-25 05:42:31 -05:00
|
|
|
# This makes querying this information a lot more efficient and it should be
|
2018-08-31 13:16:34 -04:00
|
|
|
# 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-05-16 02:06:55 -04:00
|
|
|
end
|