class Decidim::Meetings::Question

The data store for a Question in the Decidim::Meetings component.

def answered_by?(user)

Public: returns whether the questionnaire is answered by the user or not.
def answered_by?(user)
  questionnaire.answers.where({ user:, question: self }).any? if questionnaire.questions.present? && user.present?
end

def answers_count

def answers_count
  questionnaire.answers.where(question: self).count
end

def multiple_choice?

def multiple_choice?
  %w(single_option multiple_option).include?(question_type)
end

def number_of_options

def number_of_options
  answer_options.size
end

def translated_body

def translated_body
  Decidim::Forms::QuestionPresenter.new(self).translated_body
end