Created
March 26, 2018 07:46
-
-
Save samuels410/877ca784649bf03ed01589e391f35605 to your computer and use it in GitHub Desktop.
Canvas account level student OTP usage stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
email_otp_users = [] | |
google_otp_users = [] | |
no_login_users =[] | |
account = Account.find(70) | |
courses = account.courses | |
course_ids = courses.collect(&:id) | |
enrollments = Enrollment.where(course_id: course_ids,workflow_state: ["inactive","active"]) | |
user_ids = enrollments.collect(&:user_id).uniq | |
users = User.where(id: user_ids) | |
users.each do |user| | |
if user.otp_communication_channel_id | |
email_otp_users << user | |
elsif user.otp_secret_key_salt | |
google_otp_users << user | |
else | |
no_login_users << user | |
end | |
end | |
puts "#{account.name} OTP details : " | |
puts "Total active inactive students count : #{user_ids.size}" | |
puts "Users using email otp : #{email_otp_users.size}" | |
puts "Users using google authenticator : #{google_otp_users.size}" | |
puts "Users not logged in after we enabled OTP/Never logged in : #{no_login_users.size}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment