Rubocop autocorrections (indentations, revers unless to if, extra spaces)

This commit is contained in:
Bertocq
2017-06-07 01:11:36 +02:00
parent c45c374256
commit 02524b164a
21 changed files with 65 additions and 65 deletions

View File

@@ -10,8 +10,8 @@ class Poll::Answer < ActiveRecord::Base
validates :answer, presence: true
validates :answer, inclusion: {in: ->(a) { a.question.valid_answers }}
scope :by_author, -> (author_id) { where(author_id: author_id) }
scope :by_question, -> (question_id) { where(question_id: question_id) }
scope :by_author, ->(author_id) { where(author_id: author_id) }
scope :by_question, ->(question_id) { where(question_id: question_id) }
def record_voter_participation
Poll::Voter.create!(user: author, poll: poll)

View File

@@ -1,6 +1,6 @@
class Poll::NullResult < ActiveRecord::Base
VALID_ORIGINS = %w{ web booth }
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
@@ -9,7 +9,7 @@ class Poll::NullResult < ActiveRecord::Base
validates :author, presence: true
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, -> (author_id) { where(author_id: author_id) }
scope :by_author, ->(author_id) { where(author_id: author_id) }
before_save :update_logs
@@ -20,4 +20,4 @@ class Poll::NullResult < ActiveRecord::Base
self.author_id_log += ":#{self.author_id_was.to_s}"
end
end
end
end

View File

@@ -1,6 +1,6 @@
class Poll::PartialResult < ActiveRecord::Base
VALID_ORIGINS = %w{ web booth }
VALID_ORIGINS = %w{web booth}
belongs_to :question, -> { with_hidden }
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
@@ -13,8 +13,8 @@ class Poll::PartialResult < ActiveRecord::Base
validates :answer, inclusion: {in: ->(a) { a.question.valid_answers }}
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, -> (author_id) { where(author_id: author_id) }
scope :by_question, -> (question_id) { where(question_id: question_id) }
scope :by_author, ->(author_id) { where(author_id: author_id) }
scope :by_question, ->(question_id) { where(question_id: question_id) }
before_save :update_logs
@@ -25,4 +25,4 @@ class Poll::PartialResult < ActiveRecord::Base
self.author_id_log += ":#{self.author_id_was.to_s}"
end
end
end
end

View File

@@ -14,7 +14,7 @@ class Poll
before_validation :set_demographic_info, :set_document_info
def set_demographic_info
return unless user.present?
return if user.blank?
self.gender = user.gender
self.age = user.age
@@ -22,7 +22,7 @@ class Poll
end
def set_document_info
return unless user.present?
return if user.blank?
self.document_type = user.document_type
self.document_number = user.document_number
@@ -51,7 +51,7 @@ class Poll
nil
else
now = Time.current.to_date
now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1)
end
end

View File

@@ -1,6 +1,6 @@
class Poll::WhiteResult < ActiveRecord::Base
VALID_ORIGINS = %w{ web booth }
VALID_ORIGINS = %w{web booth}
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
belongs_to :booth_assignment
@@ -9,7 +9,7 @@ class Poll::WhiteResult < ActiveRecord::Base
validates :author, presence: true
validates :origin, inclusion: {in: VALID_ORIGINS}
scope :by_author, -> (author_id) { where(author_id: author_id) }
scope :by_author, ->(author_id) { where(author_id: author_id) }
before_save :update_logs
@@ -20,4 +20,4 @@ class Poll::WhiteResult < ActiveRecord::Base
self.author_id_log += ":#{self.author_id_was.to_s}"
end
end
end
end