Merge branch 'master' into aperez-admin-question-videos

This commit is contained in:
Raimond Garcia
2017-10-06 01:12:22 +02:00
committed by GitHub
42 changed files with 460 additions and 277 deletions

View File

@@ -2,6 +2,7 @@ class Poll
class Officer < ActiveRecord::Base
belongs_to :user
has_many :officer_assignments, class_name: "Poll::OfficerAssignment"
has_many :shifts, class_name: "Poll::Shift"
has_many :failed_census_calls, foreign_key: :poll_officer_id
validates :user_id, presence: true, uniqueness: true

View File

@@ -1,4 +1,6 @@
class Poll::Question::Answer < ActiveRecord::Base
include Galleryable
belongs_to :question, class_name: 'Poll::Question', foreign_key: 'question_id'
has_many :videos, class_name: 'Poll::Question::Answer::Video'

View File

@@ -10,6 +10,10 @@ class Poll
enum task: { vote_collection: 0, recount_scrutiny: 1 }
scope :vote_collection, -> { where(task: 'vote_collection') }
scope :recount_scrutiny, -> { where(task: 'recount_scrutiny') }
scope :current, -> { where(date: Date.current) }
before_create :persist_data
after_create :create_officer_assignments
before_destroy :destroy_officer_assignments