diff --git a/app/models/poll/shift.rb b/app/models/poll/shift.rb index d894df5a4..d64bce9ac 100644 --- a/app/models/poll/shift.rb +++ b/app/models/poll/shift.rb @@ -7,6 +7,9 @@ class Poll validates :officer_id, presence: true validates :date, presence: true validates :date, uniqueness: { scope: [:officer_id, :booth_id] } + validates :task, presence: true + + enum task: { vote_collection: 0, recount_scrutiny: 1 } before_create :persist_data after_create :create_officer_assignments diff --git a/db/migrate/20170927110953_add_shift_task.rb b/db/migrate/20170927110953_add_shift_task.rb new file mode 100644 index 000000000..8adf23dd1 --- /dev/null +++ b/db/migrate/20170927110953_add_shift_task.rb @@ -0,0 +1,5 @@ +class AddShiftTask < ActiveRecord::Migration + def change + add_column :poll_shifts, :task, :integer, null: false, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 41063df03..fcfb88aaa 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170918231410) do +ActiveRecord::Schema.define(version: 20170927110953) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -687,6 +687,7 @@ ActiveRecord::Schema.define(version: 20170918231410) do t.datetime "updated_at" t.string "officer_name" t.string "officer_email" + t.integer "task", default: 0, null: false end add_index "poll_shifts", ["booth_id", "officer_id"], name: "index_poll_shifts_on_booth_id_and_officer_id", using: :btree