Skip to content

Commit

Permalink
Remove unused Voter methods
Browse files Browse the repository at this point in the history
AFAIK these methods were never used. In any case, the similar method
`set_demographic_info` was added in commit 6c34599.
  • Loading branch information
javierm committed Nov 9, 2019
1 parent e8af4c1 commit 5703a04
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions app/models/poll/voter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,5 @@ def set_document_info
def set_denormalized_booth_assignment_id
self.booth_assignment_id ||= officer_assignment&.booth_assignment_id
end

def in_census?
census_api_response.valid?
end

def census_api_response
@census_api_response ||= CensusCaller.new.call(document_type, document_number)
end

def fill_stats_fields
if in_census?
self.gender = census_api_response.gender
self.geozone_id = Geozone.select(:id).find_by(census_code: census_api_response.district_code)&.id
self.age = voter_age(census_api_response.date_of_birth)
end
end

def voter_age(dob)
if dob.blank?
nil
else
now = Date.current
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)
end
end
end
end

0 comments on commit 5703a04

Please sign in to comment.