From 5223ec664c82219a78cfa9f5a096df733aa2ed12 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Fri, 30 Oct 2015 19:26:25 +0100 Subject: [PATCH] adds physical_votes to vote counter --- app/models/proposal.rb | 2 +- .../20151030182217_add_physical_votes_to_proposals.rb | 5 +++++ db/schema.rb | 7 +++---- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20151030182217_add_physical_votes_to_proposals.rb diff --git a/app/models/proposal.rb b/app/models/proposal.rb index d56b1fa90..0ddd11c69 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -62,7 +62,7 @@ class Proposal < ActiveRecord::Base end def total_votes - cached_votes_up + cached_votes_up + physical_votes end def editable? diff --git a/db/migrate/20151030182217_add_physical_votes_to_proposals.rb b/db/migrate/20151030182217_add_physical_votes_to_proposals.rb new file mode 100644 index 000000000..367f09f48 --- /dev/null +++ b/db/migrate/20151030182217_add_physical_votes_to_proposals.rb @@ -0,0 +1,5 @@ +class AddPhysicalVotesToProposals < ActiveRecord::Migration + def change + add_column :proposals, :physical_votes, :integer, default: 0 + end +end diff --git a/db/schema.rb b/db/schema.rb index 7ccb628cc..823406cbf 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: 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