Switch all Time.curren.to_date for Date.current, same result but better syntax
This commit is contained in:
@@ -26,7 +26,7 @@ class Officing::ResidenceController < Officing::BaseController
|
||||
@officer_assignments = current_user.poll_officer.
|
||||
officer_assignments.
|
||||
voting_days.
|
||||
where(date: Time.current.to_date)
|
||||
where(date: Date.current)
|
||||
end
|
||||
|
||||
def validate_officer_assignment
|
||||
|
||||
@@ -50,7 +50,7 @@ class Poll
|
||||
if dob.blank?
|
||||
nil
|
||||
else
|
||||
now = Time.current.to_date
|
||||
now = Date.current
|
||||
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
module Age
|
||||
def self.in_years(dob, now = Time.current.to_date)
|
||||
def self.in_years(dob, now = Date.current)
|
||||
return nil if dob.blank?
|
||||
# reference: http://stackoverflow.com/questions/819263/get-persons-age-in-ruby#comment21200772_819263
|
||||
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)
|
||||
|
||||
@@ -429,7 +429,7 @@ FactoryGirl.define do
|
||||
factory :poll_officer_assignment, class: 'Poll::OfficerAssignment' do
|
||||
association :officer, factory: :poll_officer
|
||||
association :booth_assignment, factory: :poll_booth_assignment
|
||||
date Time.current.to_date
|
||||
date Date.current
|
||||
|
||||
trait :final do
|
||||
final true
|
||||
|
||||
@@ -144,7 +144,7 @@ feature 'Admin booths assignments' do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||
today = Time.current.to_date
|
||||
today = Date.current
|
||||
officer_assignment = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: today)
|
||||
|
||||
recount = create(:poll_recount,
|
||||
|
||||
Reference in New Issue
Block a user