Rubocop autocorrections (indentations, revers unless to if, extra spaces)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user