-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Display all polls for current booth #3361
Conversation
ed684ed
to
508a757
Compare
Polls that were not votable by a user were not being displayed in the officing interface. Creating a confusing situation for officers. With this commit polls that are not votable by a user will be displayed, with the corresponding message explaining that that poll can only be voted by residents of a certain geozone.
Budget polls behave slightly differently to non-budget polls. In budget polls we use Budget::Ballot::Lines to verify if a user has already voted online. In non-budget polls we use Poll::Voter to verify this. In this commit we are adding an extra check to make sure that the correct message is displayed if the user has already voted online for a budget poll[1] [1] https://github.com/AyuntamientoMadrid/consul/blob/master/spec/features/budget_polls/voter_spec.rb#L122
508a757
to
e1141d1
Compare
booth_assignment2 = create(:poll_booth_assignment, poll: poll2, booth: booth2) | ||
|
||
officer_assignment1 = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment1) | ||
officer_assignment2 = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment2) |
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 - officer_assignment2. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [115/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
booth_assignment1 = create(:poll_booth_assignment, poll: poll1, booth: booth1) | ||
booth_assignment2 = create(:poll_booth_assignment, poll: poll2, booth: booth2) | ||
|
||
officer_assignment1 = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment1) |
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 - officer_assignment1. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [115/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario "Do not display expired polls" do | ||
expired_poll = create(:poll, :expired) | ||
booth_assignment = create(:poll_booth_assignment, poll: expired_poll, booth: booth) | ||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment) |
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 - officer_assignment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [113/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario "Display polls that the user cannot vote" do | ||
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")]) | ||
booth_assignment = create(:poll_booth_assignment, poll: unvotable_poll, booth: booth) | ||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment) |
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 - officer_assignment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [113/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
end | ||
|
||
scenario "Display polls that the user cannot vote" do | ||
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")]) |
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. [121/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario "Display polls that the user can vote" do | ||
votable_poll = create(:poll, :current, geozone_restricted: true, geozones: [Geozone.first]) | ||
booth_assignment = create(:poll_booth_assignment, poll: votable_poll, booth: booth) | ||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment) |
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 - officer_assignment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [113/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario "Display current polls assigned to a booth" do | ||
poll = create(:poll, :current) | ||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth) | ||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment) |
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 - officer_assignment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [113/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario "Cannot vote" do | ||
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")]) | ||
booth_assignment = create(:poll_booth_assignment, poll: unvotable_poll, booth: booth) | ||
officer_assignment = create(:poll_officer_assignment, officer: officer, booth_assignment: booth_assignment) |
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 - officer_assignment. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Metrics/LineLength: Line is too long. [111/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
@@ -36,7 +36,22 @@ | |||
expect(Poll::Voter.last.officer_id).to eq(officer.id) | |||
end | |||
|
|||
scenario "Already voted", :js do | |||
scenario "Cannot vote" do | |||
unvotable_poll = create(:poll, :current, geozone_restricted: true, geozones: [create(:geozone, census_code: "02")]) |
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. [119/110] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
References
Display all polls for current booth AyuntamientoMadrid#1919
Context
Polls that were not votable by a user were not being displayed in the officing interface. Creating a confusing situation for officers.
Objectives
Polls that are not votable by a user should be displayed and a corresponding message displayed explaining that a poll can only be voted by residents of a certain geozone.
Visual Changes