Add more options for surveys
* Survey period constraints * Add abilities * Enforce required questions * Update survey_submssion updated_at * Do a full match of possible answer and user reply
This commit is contained in:
parent
c278e547ce
commit
683f62a27c
36 changed files with 219 additions and 74 deletions
|
|
@ -1,12 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Survey < ActiveRecord::Base
|
||||
belongs_to :surveyable, polymorphic: true
|
||||
has_many :survey_questions
|
||||
has_many :survey_submissions
|
||||
has_many :survey_questions, dependent: :destroy
|
||||
has_many :survey_submissions, dependent: :destroy
|
||||
|
||||
enum target: [:after_conference, :during_registration]
|
||||
validates :title, presence: true
|
||||
|
||||
def active?
|
||||
return false unless start_date && end_date
|
||||
now = Time.now.in_time_zone(surveyable.timezone)
|
||||
now >= start_date && now <= end_date
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue