Hotfixes

Stephen Paul Weber created

Change summary

bin/cancel_expired_customers | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Detailed changes

bin/cancel_expired_customers 🔗

@@ -101,12 +101,13 @@ class ExpiringCustomer
 				raise "#{@customer_id} not found"
 			end
 
-			iq
+			@info = iq
 		end
 	end
 
 	def next
-		raise "Call info first" unless @sessionid
+		raise "Call info first" unless @sessionid && @info
+		return EMPromise.reject(:skip) unless @info.form.field("tel")
 
 		BlatherNotify.write_with_promise(BlatherNotify.command(
 			"customer info",
@@ -138,7 +139,7 @@ ported_in_promise.then { |ported_in|
 		customer = ExpiringCustomer.new(row["customer_id"])
 		customer.info.then { |iq|
 			if ported_in.include?(iq.form.field("tel")&.value&.to_s) &&
-			   row["expires_at"] > (Date.today << 12)
+			   row["expires_at"] > (Date.today << 12).to_time
 				puts "#{row['customer_id']} ported in, skipping"
 				EMPromise.reject(:skip)
 			else