Sha256: 8c5ef116f9942d7b5f2accbf87f876a8d0dc87415ebc870cdadb8ad3334c7a59

Contents?: true

Size: 751 Bytes

Versions: 6

Compression:

Stored size: 751 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    # The data store for a Questionnaire in the Decidim::Meetings component.
    class Questionnaire < Meetings::ApplicationRecord
      include Decidim::Traceable

      belongs_to :questionnaire_for, polymorphic: true

      has_many :questions, -> { order(:position) }, class_name: "Question", foreign_key: "decidim_questionnaire_id", dependent: :destroy
      has_many :answers, class_name: "Answer", foreign_key: "decidim_questionnaire_id", dependent: :destroy

      def all_questions_unpublished?
        questions.all?(&:unpublished?)
      end

      def self.log_presenter_class_for(_log)
        Decidim::Meetings::AdminLog::QuestionnairePresenter
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 app/models/decidim/meetings/questionnaire.rb
decidim-meetings-0.29.0 app/models/decidim/meetings/questionnaire.rb
decidim-meetings-0.29.0.rc4 app/models/decidim/meetings/questionnaire.rb
decidim-meetings-0.29.0.rc3 app/models/decidim/meetings/questionnaire.rb
decidim-meetings-0.29.0.rc2 app/models/decidim/meetings/questionnaire.rb
decidim-meetings-0.29.0.rc1 app/models/decidim/meetings/questionnaire.rb