adds physical_votes to vote counter
This commit is contained in:
@@ -62,7 +62,7 @@ class Proposal < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def total_votes
|
||||
cached_votes_up
|
||||
cached_votes_up + physical_votes
|
||||
end
|
||||
|
||||
def editable?
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddPhysicalVotesToProposals < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :proposals, :physical_votes, :integer, default: 0
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151028221647) do
|
||||
ActiveRecord::Schema.define(version: 20151030182217) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -94,10 +94,10 @@ ActiveRecord::Schema.define(version: 20151028221647) 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
|
||||
@@ -113,7 +113,6 @@ ActiveRecord::Schema.define(version: 20151028221647) do
|
||||
add_index "debates", ["cached_votes_total"], name: "index_debates_on_cached_votes_total", using: :btree
|
||||
add_index "debates", ["cached_votes_up"], name: "index_debates_on_cached_votes_up", using: :btree
|
||||
add_index "debates", ["confidence_score"], name: "index_debates_on_confidence_score", using: :btree
|
||||
add_index "debates", ["description"], name: "index_debates_on_description", using: :btree
|
||||
add_index "debates", ["hidden_at"], name: "index_debates_on_hidden_at", using: :btree
|
||||
add_index "debates", ["hot_score"], name: "index_debates_on_hot_score", using: :btree
|
||||
add_index "debates", ["title"], name: "index_debates_on_title", using: :btree
|
||||
@@ -213,13 +212,13 @@ ActiveRecord::Schema.define(version: 20151028221647) do
|
||||
t.string "responsible_name", limit: 60
|
||||
t.text "summary"
|
||||
t.string "video_url"
|
||||
t.integer "physical_votes", default: 0
|
||||
end
|
||||
|
||||
add_index "proposals", ["author_id", "hidden_at"], name: "index_proposals_on_author_id_and_hidden_at", using: :btree
|
||||
add_index "proposals", ["author_id"], name: "index_proposals_on_author_id", using: :btree
|
||||
add_index "proposals", ["cached_votes_up"], name: "index_proposals_on_cached_votes_up", using: :btree
|
||||
add_index "proposals", ["confidence_score"], name: "index_proposals_on_confidence_score", using: :btree
|
||||
add_index "proposals", ["description"], name: "index_proposals_on_description", using: :btree
|
||||
add_index "proposals", ["hidden_at"], name: "index_proposals_on_hidden_at", using: :btree
|
||||
add_index "proposals", ["hot_score"], name: "index_proposals_on_hot_score", using: :btree
|
||||
add_index "proposals", ["question"], name: "index_proposals_on_question", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user