Merge pull request #1319 from consul/signature-sheets-cleanup

Signature sheets cleanup
This commit is contained in:
Juanjo Bazán
2016-12-30 12:58:41 +01:00
committed by GitHub
4 changed files with 8 additions and 13 deletions

View File

@@ -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

View File

@@ -0,0 +1,5 @@
class RemovePhysicalVotesFromProposals < ActiveRecord::Migration
def change
remove_column :proposals, :physical_votes
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: 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"

View File

@@ -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