diff --git a/app/controllers/candidate_controller.rb b/app/controllers/candidate_controller.rb index 78a5ec0..0cd4f4c 100644 --- a/app/controllers/candidate_controller.rb +++ b/app/controllers/candidate_controller.rb @@ -12,7 +12,7 @@ class CandidateController < ApplicationController end def welcome - render :welcome_back if current_candidate.answers.count > 0 + render :welcome_back if current_candidate.answers.count.positive? end def saved diff --git a/app/validators/input_options_presence_validator.rb b/app/validators/input_options_presence_validator.rb index 5a5c60d..0b2e89a 100644 --- a/app/validators/input_options_presence_validator.rb +++ b/app/validators/input_options_presence_validator.rb @@ -2,7 +2,7 @@ class InputOptionsPresenceValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return true unless record.input_type =~ /radio|check/i - return true if value.present? && value.count > 0 + return true if value.present? && value.count.positive? record.errors[attribute] << (options[:message] || "You must provide answer options for the selected input type.") diff --git a/app/workers/quiz_status.rb b/app/workers/quiz_status.rb index f97037e..bde0c82 100644 --- a/app/workers/quiz_status.rb +++ b/app/workers/quiz_status.rb @@ -7,7 +7,7 @@ class QuizStatus end def started - candidate.answers.count > 0 + candidate.answers.count.positive? end def on_summary