Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Upstream] Budgets approval voting #1843

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

voodoorai2000
Copy link
Member

References

PR: consuldemocracy#3199

Objectives

Add approval voting system for participatory budgets

Does this PR need a Backport to CONSUL?

No, it comes from upstream

Is manual testing required?

Yes manual testing in the staging environment is required

let!(:city) { create(:budget_group, budget: budget, name: "City") }
let!(:districts) { create(:budget_group, budget: budget, name: "Districts") }
let!(:city) { create(:budget_group, budget: budget, name: "City", voting_style: "knapsack") }
let!(:districts) { create(:budget_group, budget: budget, name: "Districts", voting_style: "knapsack") }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [107/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

@@ -4,7 +4,7 @@

let!(:user) { create(:user, :level_two) }
let!(:budget) { create(:budget, phase: "balloting") }
let!(:states) { create(:budget_group, budget: budget, name: "States") }
let!(:states) { create(:budget_group, budget: budget, name: "States", voting_style: "knapsack") }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [103/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

investment3 = create(:budget_investment, heading: heading)

create(:vote, voter: @manuela, votable: investment1, vote_flag: true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected. (https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace)

investment2 = create(:budget_investment, heading: heading)
investment3 = create(:budget_investment, heading: heading)

create(:vote, voter: @manuela, votable: investment1, vote_flag: true)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSpec/InstanceVariable: Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)

scenario 'Progress bar', :js do
investment1 = create(:budget_investment, heading: heading)
investment2 = create(:budget_investment, heading: heading)
investment3 = create(:budget_investment, heading: heading)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - investment3. Did you mean investment1? (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)

end

trait :approval do
voting_style 'approval'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

@@ -87,6 +87,14 @@
trait :drafting_budget do
association :budget, factory: [:budget, :drafting]
end

trait :knapsack do
voting_style 'knapsack'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

@@ -1,2 +1,3 @@
class Vote < ActsAsVotable::Vote
KINDS = %w(knapsack approval)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/PercentLiteralDelimiters: %w-literals should be delimited by [ and ]. (https://github.com/bbatsov/ruby-style-guide#percent-literal-braces)

@@ -237,6 +237,7 @@ def reason_for_not_being_ballotable_by(user, ballot)
return :not_selected unless selected?
return :no_ballots_allowed unless budget.balloting?
return :different_heading_assigned_html unless ballot.valid_heading?(heading)
return :not_enough_available_votes_html if heading.group.approval_voting? && ballot.investments.count == heading.group.number_votes_per_heading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [149/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)

end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/Syntax: unexpected token $end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants