adds Poll::Recount

This commit is contained in:
Juanjo Bazán
2017-01-02 13:34:53 +01:00
parent 08ea4b35eb
commit 85b8f54570
3 changed files with 39 additions and 3 deletions

View File

@@ -0,0 +1,9 @@
class Poll
class Recount < ActiveRecord::Base
belongs_to :booth_assignment, class_name: "Poll::BoothAssignment"
belongs_to :officer_assignment, class_name: "Poll::OfficerAssignment"
validates :officer_assignment_id, presence: true, uniqueness: {scope: :booth_assignment_id}
validates :count, presence: true
end
end

View File

@@ -0,0 +1,15 @@
class CreatePollRecounts < ActiveRecord::Migration
def change
create_table :poll_recounts do |t|
t.integer :booth_assignment_id
t.integer :officer_assignment_id
t.integer :count
t.text :count_log, default: ""
t.timestamps null: false
end
add_index :poll_recounts, :booth_assignment_id
add_index :poll_recounts, :officer_assignment_id
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161229110336) do
ActiveRecord::Schema.define(version: 20170102114446) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -123,10 +123,10 @@ ActiveRecord::Schema.define(version: 20161229110336) do
t.string "visit_id"
t.datetime "hidden_at"
t.integer "flags_count", default: 0
t.datetime "ignored_flag_at"
t.integer "cached_votes_total", default: 0
t.integer "cached_votes_up", default: 0
t.integer "cached_votes_down", default: 0
t.datetime "ignored_flag_at"
t.integer "comments_count", default: 0
t.datetime "confirmed_hide_at"
t.integer "cached_anonymous_votes_total", default: 0
@@ -336,6 +336,18 @@ ActiveRecord::Schema.define(version: 20161229110336) do
add_index "poll_questions", ["proposal_id"], name: "index_poll_questions_on_proposal_id", using: :btree
add_index "poll_questions", ["tsv"], name: "index_poll_questions_on_tsv", using: :gin
create_table "poll_recounts", force: :cascade do |t|
t.integer "booth_assignment_id"
t.integer "officer_assignment_id"
t.integer "count"
t.text "count_log", default: ""
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "poll_recounts", ["booth_assignment_id"], name: "index_poll_recounts_on_booth_assignment_id", using: :btree
add_index "poll_recounts", ["officer_assignment_id"], name: "index_poll_recounts_on_officer_assignment_id", using: :btree
create_table "poll_voters", force: :cascade do |t|
t.string "document_number"
t.string "document_type"
@@ -561,7 +573,7 @@ ActiveRecord::Schema.define(version: 20161229110336) do
t.boolean "email_digest", default: true
t.boolean "email_on_direct_message", default: true
t.boolean "official_position_badge", default: false
t.datetime "password_changed_at", default: '2016-12-21 17:55:08', null: false
t.datetime "password_changed_at", default: '2016-11-23 10:59:20', null: false
t.boolean "created_from_signature", default: false
end