A tool for measuring the coverage of Bluesky/ATProto relays
9
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 22 lines 508 B view raw
1require_relative 'report' 2 3class TestRun < ActiveRecord::Base 4 validates_presence_of :start_time, :duration 5 6 has_many :reports, dependent: :delete_all 7 8 def calculate_max_users 9 user_counts = self.reports.order('users').map(&:users) 10 11 if user_counts.length >= 3 12 median = user_counts[user_counts.length / 2] 13 user_counts.select { |x| x <= median * 1.1 }.last 14 else 15 user_counts.last 16 end 17 end 18 19 def update_max_users 20 self.update!(max_users: calculate_max_users) 21 end 22end