module MailerHelper def sendgrid_substitute(arg1, arg2) @vars = Hash.new unless @vars @vars[arg1] = arg2[0] end def latency_info(latency_data) latency_scores = { good: { label: 'GOOD', min: 0, max: 40 }, fair: { label: 'FAIR', min: 40, max: 60 }, high: { label: 'HIGH', min: 60, max: 10000000 }, me: { label: 'ME', min: -1, max: -1 }, unknown: { label: 'UNKNOWN', min: -2, max: -2 } } total_latency = latency_data[:ars_internet_latency].round + latency_data[:audio_latency].round; lbl = if (total_latency >= latency_scores[:good][:min] && total_latency <= latency_scores[:good][:max]) latency_scores[:good][:label] elsif (total_latency > latency_scores[:fair][:min] && total_latency <= latency_scores[:fair][:max]) latency_scores[:fair][:label] elsif (total_latency > latency_scores[:fair][:min] && total_latency <= latency_scores[:fair][:max]) latency_scores[:fair][:label] elsif (total_latency > latency_scores[:high][:min]) latency_scores[:high][:label] else latency_scores[:unknown][:label] end lbl.titleize end end