increases residence verification tries after a Census call

This commit is contained in:
rgarcia
2015-09-05 23:57:47 +02:00
parent 17ebb07daf
commit 34218d112b
4 changed files with 20 additions and 3 deletions

View File

@@ -34,12 +34,14 @@ class Verification::Residence
def residence_in_madrid
return if errors.any?
self.date_of_birth = date_to_string(date_of_birth)
residency = CensusApi.new(self)
errors.add(:residence_in_madrid, false) unless residency.valid?
unless residency.valid?
errors.add(:residence_in_madrid, false)
user.update(residence_verification_tries: user.residence_verification_tries += 1)
end
self.date_of_birth = string_to_date(date_of_birth)
end