-
Notifications
You must be signed in to change notification settings - Fork 16
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
base: master
Are you sure you want to change the base?
Conversation
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") } |
There was a problem hiding this comment.
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") } |
There was a problem hiding this comment.
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) | ||
|
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
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