Module: CountHelper
- Defined in:
- app/helpers/count_helper.rb
Instance Method Summary collapse
- #approximate_count_with_delimiters(count_data, model) ⇒ Object
-
#approximate_fork_count_with_delimiters(count_data) ⇒ Object
This will approximate the fork count by checking all counting all fork network memberships, and deducting 1 for each root of the fork network.
Instance Method Details
#approximate_count_with_delimiters(count_data, model) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/helpers/count_helper.rb', line 4 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) end |
#approximate_fork_count_with_delimiters(count_data) ⇒ Object
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 inaccurate as the root of the fork network might have been deleted.
This makes querying this information a lot more efficient and it should be accurate enough for the instance wide statistics
18 19 20 21 22 23 24 |
# File 'app/helpers/count_helper.rb', line 18 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 |