improves incomplete verification scope [#500]

This commit is contained in:
rgarcia
2015-09-24 15:23:49 +02:00
parent 9ced80fe8c
commit 8c56e28cce
3 changed files with 12 additions and 20 deletions

View File

@@ -6,8 +6,7 @@ module Verification
scope :level_two_verified, -> { where("users.confirmed_phone IS NOT NULL AND users.residence_verified_at IS NOT NULL") }
scope :level_two_or_three_verified, -> { where("users.verified_at IS NOT NULL OR (users.confirmed_phone IS NOT NULL AND users.residence_verified_at IS NOT NULL)") }
scope :unverified, -> { where("users.verified_at IS NULL AND (users.residence_verified_at IS NULL OR users.confirmed_phone IS NULL)") }
scope :with_failed_attempts, -> { where("users.failed_census_calls_count > ?", 0) }
scope :incomplete_verification, -> { unverified.with_failed_attempts }
scope :incomplete_verification, -> { where("(users.residence_verified_at IS NULL AND users.failed_census_calls_count > ?) OR (users.residence_verified_at IS NOT NULL AND (users.unconfirmed_phone IS NULL OR users.confirmed_phone IS NULL))", 0) }
end
def verification_email_sent?