Commit Graph

31 Commits

Author SHA1 Message Date
Javi Martín
354b183e17 Create reports
This table will store which reports (stats, results, ...) will be shown
for a certain process (polls, budgets, ...).

Note Rails fails to save a poll and its report when both are new records
if we add a `validate :process, presence: true` rule. Since it caused a
lot of trouble when creating records for tests during factories rule
completely. Instead, I've created the `results_enabled=` and
`stats_enabled=` methods, so tests are easier to set up, while also
automatically creating a report if it doesn't already exist. This also
decouples form structure and database implemenation.

Originally I named this table `enabled_reports` and instead of having
`stats` and `results` columns, it had an `enabled` column and a `kind`
column, which would be set to "stats" or "results". However, although
that table would allow us to add arbitrary reports easily, I found the
way we had to handle the `has_many` relationship was a bit too complex.
2019-05-22 11:50:03 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
rgarcia
7dd314c699 Do not display polls associated to a budget in admin poll questions
This section is used to select to which poll a question belongs to.

Budget polls are not meant to include questions that come from Citizen
Proposals or Government Questions, thus we do not display them
2019-04-03 22:20:01 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Javi Martín
8118926ba7 Simplify tests creating poll voters 2019-03-19 13:29:43 +01:00
rgarcia
8125d470de Add methods to obtain polls votable by a user 2019-03-06 17:42:46 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
decabeza
bc1679550b Remove incoming polls filter 2019-02-08 14:28:19 +01:00
rgarcia
b601f6c33f adds method voted_by?(user) to polls 2018-12-05 14:31:58 +01:00
Juan Salvador Pérez García
7c3213a55d Refactored complex scope
Complex scope has been refactored into an static method. Added tests to
validate this new method.
2018-09-17 09:11:51 +02:00
Juan Salvador Pérez García
4b8cc85c49 Fixes #234
View questions now is View results and redirects to results
in public view.

Fixed flaky spec that was making the tests fail.

Added missing specs for polls feature as well as poll model.
2018-07-19 17:15:05 +02:00
Bertocq
34bb9d65b1 Enable RSpec/NotToNot cop and fix all issues
Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
2018-01-07 17:39:48 +01:00
Bertocq
0698043340 Fix indentations 2018-01-07 01:06:07 +01:00
Bertocq
ed16a78f42 Enables RSpec/ExampleWording and fixes all issues
Both avoiding 'should' and repiting 'it' on the tests description
improves reading them and also makes all descriptions consistent.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
2018-01-07 01:03:45 +01:00
Bertocq
265d4d0967 Enables RSpec/DescribedClass cop & fixes all issues
Autocorrection for existing issues, and stashing at .rubocop_todo.yml
the false positives

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
2018-01-07 00:38:19 +01:00
rgarcia
2b52d26d82 refactors notifications into concerns and shared examples 2017-12-14 16:15:30 +01:00
Bertocq
9146d68c53 Add current_or_recounting_or_incoming method to Poll model 2017-10-13 16:53:03 +02:00
Bertocq
ca2d9a1d68 Add recounting Poll scope with trait and spec 2017-10-13 16:51:58 +02:00
rgarcia
085991c624 allows voting only in one origin: booth or web 2017-10-02 16:22:31 +02:00
decabeza
1de763a737 removes deprecated specs 2017-09-06 18:07:46 +02:00
rgarcia
0aba196ba2 adds specs for shifts 2017-08-04 21:27:30 +02:00
Bertocq
c9bc028524 Remove all unnecesary extra spacing and Layout/ExtraSpacing list from rubocop file 2017-06-28 14:12:51 +02:00
kikito
86d42ce094 Adds specs for Poll.answerable_by, fixing issue with SQL join 2017-02-02 16:41:04 +01:00
rgarcia
c74587d921 fixes specs 2017-01-29 14:13:24 +01:00
Juanjo Bazán
b13a76963a records participation of user via web
answering a poll question creates a voter with the user data to record
participation in question’s poll
2017-01-25 14:21:03 +01:00
Juanjo Bazán
1aa845a9c6 adds published to polls 2017-01-02 18:23:24 +01:00
Juanjo Bazán
bc690748fd adds dates validation to polls 2016-12-21 13:50:15 +01:00
Juanjo Bazán
45d26f6dee refactors poll::voter
now belongs_to booth_assignment instead of to booth
2016-12-06 20:20:18 +01:00
rgarcia
84bafa8107 adds specs for poll state 2016-11-21 11:19:03 +01:00
rgarcia
6e6d2ac753 moves poll spec to poll folder 2016-11-14 13:56:49 +01:00