Merge pull request #1319 from consul/signature-sheets-cleanup
Signature sheets cleanup
This commit is contained in:
@@ -50,7 +50,7 @@ class Proposal < ActiveRecord::Base
|
|||||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
||||||
scope :retired, -> { where.not(retired_at: nil) }
|
scope :retired, -> { where.not(retired_at: nil) }
|
||||||
scope :not_retired, -> { where(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
|
def to_param
|
||||||
"#{id}-#{title}".parameterize
|
"#{id}-#{title}".parameterize
|
||||||
@@ -99,7 +99,7 @@ class Proposal < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def total_votes
|
def total_votes
|
||||||
cached_votes_up + physical_votes
|
cached_votes_up
|
||||||
end
|
end
|
||||||
|
|
||||||
def voters
|
def voters
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class RemovePhysicalVotesFromProposals < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
remove_column :proposals, :physical_votes
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# 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
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
@@ -297,7 +297,6 @@ ActiveRecord::Schema.define(version: 20161221151239) do
|
|||||||
t.string "responsible_name", limit: 60
|
t.string "responsible_name", limit: 60
|
||||||
t.text "summary"
|
t.text "summary"
|
||||||
t.string "video_url"
|
t.string "video_url"
|
||||||
t.integer "physical_votes", default: 0
|
|
||||||
t.tsvector "tsv"
|
t.tsvector "tsv"
|
||||||
t.integer "geozone_id"
|
t.integer "geozone_id"
|
||||||
t.datetime "retired_at"
|
t.datetime "retired_at"
|
||||||
|
|||||||
@@ -13,11 +13,6 @@ describe ProposalsHelper do
|
|||||||
expect(progress_bar_percentage(proposal)).to eq 50
|
expect(progress_bar_percentage(proposal)).to eq 50
|
||||||
end
|
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
|
it "should be 100 if there are more votes than needed" do
|
||||||
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
|
proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success*2)
|
||||||
expect(progress_bar_percentage(proposal)).to eq 100
|
expect(progress_bar_percentage(proposal)).to eq 100
|
||||||
@@ -45,10 +40,6 @@ describe ProposalsHelper do
|
|||||||
expect(supports_percentage(proposal)).to eq "100%"
|
expect(supports_percentage(proposal)).to eq "100%"
|
||||||
end
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user