Commit Graph

13615 Commits

Author SHA1 Message Date
Javier Martín
137daba9bd Merge pull request #3570 from consul/valid_votes
Fix valid votes labels
2019-05-30 18:02:15 +02:00
Javi Martín
31515ddd45 Include blank and null ballots in booth totals
Just the same way it's done for all polls.
2019-05-30 17:22:41 +02:00
Javi Martín
123196e4ed Display the same results for stats and recounts
In the recounts we were incorrectly assuming the total amount included
the blank and invalid ballots.
2019-05-30 17:22:39 +02:00
Javi Martín
6881ee134a Fix valid ballots label
It was incorrectly labeled as "total ballots", which actually meant
"total valid ballots", but users were unsure as to whether include
blank and invalid ballots in that amount.
2019-05-30 17:22:16 +02:00
Julian Herrero
d4ec750428 Show archived proposals in selected proposals list 2019-05-30 11:19:38 +02:00
Julian Herrero
4be4d96710 Don't show order links in selected proposals list 2019-05-30 11:19:38 +02:00
Julian Herrero
6e905c517f Don't show recommented proposals in selected proposals list 2019-05-30 11:19:38 +02:00
Julian Herrero
dfe3764616 Don't show featured proposals in selected proposals list 2019-05-30 11:19:38 +02:00
Julian Herrero
5952c2664d Show a 'Selected proposal' message in the show view 2019-05-30 11:19:38 +02:00
Julian Herrero
a852696eeb Remove not selected proposals from other lists 2019-05-30 11:19:38 +02:00
Julian Herrero
6beb11f0a9 Show completed progress bar for successful proposals
Show a completed progress bar with total supports intead of showing
a message telling the proposal has reached the needed supports.
2019-05-30 11:19:38 +02:00
Julian Herrero
db774e3fd2 Extract proposal supports progress bar to a partial 2019-05-30 11:19:38 +02:00
Julian Herrero
b68a872298 Change links for proposals lists
Changed applied:

- Remove Archived proposals from tab and add a link under Proposals
  lists
- Remove Popular proposals link from custom section and add it to the
  Proposals lists
- Remove Retired proposals link from custom section and add it to the
  Proposals lists
- Remove Selected proposals link from custom section and add it to the
  Proposals lists
2019-05-30 11:19:38 +02:00
Julian Herrero
28835a29ef Share helper between class Proposal and Legislation::Proposal 2019-05-30 11:19:38 +02:00
Julian Herrero
ad5f7a06e1 Allow admins to select proposals and users to list them 2019-05-30 11:19:33 +02:00
Javier Martín
b1f34c31ab Merge pull request #3533 from consul/regenerate_schema
Fix column order in schema file
2019-05-29 22:03:37 +02:00
Javier Martín
80096d9654 Merge pull request #3563 from consul/add_lines_count_rake
Add task to regenerate ballot_lines_count cache
2019-05-29 21:17:40 +02:00
Javi Martín
dbcc5fb724 Use AR relations when merging comments
Using arrays made it difficult to order by more than one field (like the
`most_voted` scope does), and so we were ordering by `confidence_score`
and ignoring the `created_at` column.

Using an AR relation makes it easy to reuse the existing `most_voted`
scope.

This change has one side effect: now comments with equal votes are
ordered in descending order instead of having no specific order. That
means flaky specs which failed sometimes because they assumed comments
were ordered by date are now always green.

I've also re-added the `oldest` scope removed in 792b15b thinking it was
removed because using it with arrays was too hard.
2019-05-29 20:50:53 +02:00
Javi Martín
7b5ce80593 Simplify MergedCommentTree#initialize
By setting the comments lazily in a different method, we can share its
code with the parent class.
2019-05-29 20:50:53 +02:00
Javi Martín
24236e654c Fix column order in schema file
When introducing Rails 5 and the dashboard, we generated the schema file
without dropping the database first. When doing so locally, migrations
aren't always executed in order, changing the order of the columns.
2019-05-29 20:49:29 +02:00
Javi Martín
dd851cb6cc Add task to regenerate ballot_lines_count cache
We've added this column recently to `budget_ballots`, and we use it to
calculate stats.
2019-05-29 20:39:19 +02:00
Javier Martín
14a5ea87a1 Merge pull request #3562 from consul/prepare_for_rails_5.1
Add Rails 5.1 compatibility
2019-05-29 19:11:19 +02:00
Julian Herrero
9948804e21 Add selected attribute to proposals 2019-05-29 16:51:27 +02:00
Alberto
24bab90cff Merge pull request #3539 from consul/hide-token
Remove token on views
2019-05-29 16:28:35 +02:00
decabeza
585f9ea5ab Remove token on views temporally 2019-05-29 15:49:28 +02:00
Alberto
392abcddf8 Merge pull request #3561 from consul/reset-password-message
Change devise configuration
2019-05-29 15:23:17 +02:00
Javi Martín
8f69399799 Add version to migration files
These migrations were backported after upgrading to Rails 5.
2019-05-28 16:40:52 +02:00
Javi Martín
241ee313f1 Use paths instead of URLs where possible
It simplifies the code and solves any issue we might have configuring
the host in the test environment.
2019-05-28 16:38:45 +02:00
Javi Martín
db6ed4772c Update travel_to usage
In Rails 5.1, calling `travel_to` inside another `travel_to` block will
result in a RuntimeError:

> Calling `travel_to` with a block, when we have previously already made
> a call to `travel_to`, can lead to confusing time stubbing.
2019-05-28 16:36:56 +02:00
Javi Martín
307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00
Javi Martín
234a5108a4 Use strings for class_name
As mentioned in the Rails console:

DEPRECATION WARNING: Passing a class to the `class_name` is deprecated
and will raise an ArgumentError in Rails 5.2. It eagerloads more classes
than necessary and potentially creates circular dependencies. Please
pass the class name as a string.
2019-05-28 14:26:18 +02:00
Javi Martín
e445e14d65 Use ActiveSupport::HashWithIndifferentAccess
Using `HashWithIndifferentAccess` directly will be deprecated in Rails
5.1.
2019-05-28 14:23:54 +02:00
decabeza
c2acd53a06 Change devise configuration
This change don't let the user know if the email address exists when asking to resend confirmation or password reset instructions.
2019-05-28 14:23:37 +02:00
Javier Martín
c43a1a2096 Merge pull request #3361 from consul/polls_unanswerable
Display all polls for current booth
2019-05-28 13:53:27 +02:00
voodoorai2000
e1141d1cd3 Display already voted message for budget polls
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
2019-05-24 15:20:54 +02:00
voodoorai2000
5abde6da6e Simplify html tag structure 2019-05-24 15:20:54 +02:00
voodoorai2000
29f5268e42 Display polls for current booth
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.
2019-05-24 15:20:54 +02:00
Javier Martín
3cb6920a36 Merge pull request #3534 from consul/fix_capybara_window
Resize Capybara window back to its original size
2019-05-24 15:18:07 +02:00
Javi Martín
605da522cb Resize Capybara window back to its original size
The `maximize` method didn't work as we expected and didn't resize the
window, causing issues in tests expecting the window to be larger.
2019-05-24 13:30:49 +02:00
Julian Nicolas Herrero
2c85e293cf Merge pull request #3530 from consul/remove_rspec_deprecation_warnings
Remove Rspec deprecation warning
2019-05-23 18:33:24 +02:00
Julian Nicolas Herrero
67c6aa1a42 Merge pull request #3529 from consul/rubocop_line_long_to_110_characters
Allow lines to be 110 characters long by Rubocop
2019-05-23 16:17:59 +02:00
Julian Herrero
bb25da2572 Remove Rspec deprecation warning
DEPRECATION WARNING: Using positional arguments in functional tests
has been deprecated, in favor of keyword arguments, and will be
removed in Rails 5.1.

Deprecated style:
get :show, { id: 1 }, nil, { notice: "Flash message" }

New keyword style:
get :show, params: { id: 1 }, flash: { notice: "Flash message" }
2019-05-23 13:19:45 +02:00
Julian Herrero
7066dd50d5 Allow lines to be 110 characters long 2019-05-23 13:16:02 +02:00
Javier Martín
387488aa68 Merge pull request #3520 from consul/backport-refactor_stats_enabled
Add options to show advanced stats
2019-05-23 13:07:19 +02:00
Javier Martín
afdc7087d7 Merge pull request #3519 from consul/backport-remove_custom_poll_group_file
Simplify link to poll
2019-05-23 13:06:50 +02:00
Alberto
7abeb599c0 Merge pull request #3515 from consul/proposals-support-mobile
Proposals support on mobile
2019-05-22 18:12:31 +02:00
Javi Martín
9ae0cbb254 Add task to migrate enabled poll results and stats 2019-05-22 12:48:11 +02:00
decabeza
148ea1ede9 Prevent notice been overlapped by header 2019-05-22 12:42:03 +02:00
decabeza
f37a2bd0a8 Change js depending of window with 2019-05-22 12:42:00 +02:00
decabeza
69cada5f9b Prevent header overlaps the support button 2019-05-22 12:41:57 +02:00