diff --git a/app/models/proposal.rb b/app/models/proposal.rb index 7bd4b7a92..2f0c76094 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -50,7 +50,7 @@ class Proposal < ActiveRecord::Base scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)} scope :retired, -> { where.not(retired_at: nil) } scope :not_retired, -> { where(retired_at: nil) } - scope :successfull, -> { where("cached_votes_up + physical_votes >= ?", Proposal.votes_needed_for_success)} + scope :successfull, -> { where("cached_votes_up >= ?", Proposal.votes_needed_for_success)} def to_param "#{id}-#{title}".parameterize @@ -99,7 +99,7 @@ class Proposal < ActiveRecord::Base end def total_votes - cached_votes_up + physical_votes + cached_votes_up end def voters diff --git a/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb b/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb new file mode 100644 index 000000000..34e0e5e44 --- /dev/null +++ b/db/migrate/20161229110336_remove_physical_votes_from_proposals.rb @@ -0,0 +1,5 @@ +class RemovePhysicalVotesFromProposals < ActiveRecord::Migration + def change + remove_column :proposals, :physical_votes + end +end diff --git a/db/schema.rb b/db/schema.rb index acfc87dbb..0c3cfd3cf 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: 20161221151239) do +ActiveRecord::Schema.define(version: 20161229110336) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -297,7 +297,6 @@ ActiveRecord::Schema.define(version: 20161221151239) do t.string "responsible_name", limit: 60 t.text "summary" t.string "video_url" - t.integer "physical_votes", default: 0 t.tsvector "tsv" t.integer "geozone_id" t.datetime "retired_at" diff --git a/spec/helpers/proposals_helper_spec.rb b/spec/helpers/proposals_helper_spec.rb index 82206afb5..cee1ec648 100644 --- a/spec/helpers/proposals_helper_spec.rb +++ b/spec/helpers/proposals_helper_spec.rb @@ -13,11 +13,6 @@ describe ProposalsHelper do expect(progress_bar_percentage(proposal)).to eq 50 end - it "should take into account the physical votes" do - proposal = create(:proposal, cached_votes_up: ((Proposal.votes_needed_for_success/2)-100), physical_votes: 100) - expect(progress_bar_percentage(proposal)).to eq 50 - end - it "should be 100 if there are more votes than needed" do proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2) expect(progress_bar_percentage(proposal)).to eq 100 @@ -45,10 +40,6 @@ describe ProposalsHelper do expect(supports_percentage(proposal)).to eq "100%" end - it "should take into account the physical votes" do - proposal = create(:proposal, physical_votes: Proposal.votes_needed_for_success/2) - expect(supports_percentage(proposal)).to eq "50%" - end end end \ No newline at end of file