Find Bad Customers

Christopher Vollick created

This is meant to go through all customers who aren't already on sgx_jmp
and who don't already have an open porting request to get them there.

Change summary

bin/find_bad_customers | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Detailed changes

bin/find_bad_customers 🔗

@@ -0,0 +1,23 @@
+#!/usr/bin/ruby
+# frozen_string_literal: true
+
+require "redis"
+redis = Redis.new
+
+raise "GIVE ME FILE" unless ARGV[0]
+
+PORTING_NUMBERS = File.read(ARGV[0]).split("\n")
+
+redis.scan_each(match: "catapult_jid-*", count: 1000) do |key|
+	tel = key[13..-1]
+	next if PORTING_NUMBERS.include? tel
+
+	jid = redis.get(key)
+	next if jid.start_with?("customer_")
+
+	other_tel = redis.lindex("catapult_cred-#{jid}", -1)
+	next unless other_tel
+	next unless tel == other_tel
+
+	puts jid
+end