daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace :member do
  2.   desc "finds mismatched external user ids with users for university site"
  3.   task :university_external_user_id => :environment do
  4.     university = Site.find(ENV["UNIVERSITY_SITE_ID"])
  5.     members = university.members
  6.     count = 0
  7.  
  8.     members.find_each do |member|
  9.       email = member.email
  10.       eui   = member.external_user_id
  11.  
  12.       if eui && !eui.include?("@")
  13.         id = eui.split(":")[-1]
  14.  
  15.         if u = User.find_by(id: id)
  16.           unless u.email == email
  17.             puts "Mismatch! member_id: #{member.id}, email: #{email}, eui: #{eui}"
  18.             count +=1
  19.           end
  20.         end
  21.       end
  22.     end
  23.  
  24.     puts "count: #{count}"
  25.   end
  26. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top