Commit Graph

42 Commits

Author SHA1 Message Date
Javi Martín
9e27027f56 Remove duplicate scope
The scopes `created_by_admin` and `public_polls` were very similar. I'm
using `created_by_admin` because `Poll.public_polls` feels redundant,
and the reason for that name is we should not name the scope `public`
because `public` is a ruby access modifier.
2019-11-09 19:33:02 +01:00
Javi Martín
9ff285b9cc Use find_by_slug_or_id! to find a poll
We were manually doing a similar thing - only we weren't raising an
exception when we should.
2019-11-08 19:22:11 +01:00
Javi Martín
ea2aeab383 Apply rubocop Rails/FindBy rule everywhere
We didn't detect these cases because by default the rule only searches
for offenses in `app/models/`.
2019-11-08 19:15:04 +01:00
Javi Martín
af7c37634d Remove poll votation types
Unfortunately this feature wasn't properly reviewed and tested, and it
had many bugs, some of them critical and hard to fix, like validations
being skipped in concurrent requests.

So we're removing it before releasing version 1.1. We might add it back
in the future if we manage to solve the critical issues.

This commit reverts commit 836f9ba7.
2019-10-30 18:48:55 +01:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
06030933a4 Remove obsolete poll answers variable
This code is obsolete since commit c6e4b248.
2019-09-24 18:29:33 +02:00
Javi Martín
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
lalo
c6e4b2480f Add public changes to create and vote Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
Javi Martín
dadbf873ba Order translations using ruby
Joining the translations table caused duplicate records to appear.
Ordering with SQL is simply too hard because we need to consider
fallback locales.

Thanks Senén for providing most of the tests in the poll spec.
2019-06-03 18:35:59 +02:00
Javi Martín
76c7827cf4 Use stats objects instead of hashes
It will make it far easier to call other methods on the stats object,
and we're already caching the methods.

We had to remove the view fragment caching because the stats object
isn't as easy to cache. The good thing about it is the view will
automatically be updated when we change logic regarding which stats to
show, and the methods taking long to execute are cached in the model.
2019-05-21 13:50:18 +02:00
rgarcia
1af472b795 hotfix for polls without slugs 2019-05-16 23:40:50 +02:00
María Checa
e3b16230e6 Added slug to polls for named urls 2019-05-16 23:40:50 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Senén Rodero Rodríguez
596ef8d1ed Fix queries and scopes after column deletion
Some queries were accessing original column instead of the new
translatable one. This should have been causing unexpected behavior
for requests maded in a different locale than the application default.
2019-04-17 17:40:55 +02:00
María Checa
22727a9876 Hides budget polls in polls public index 2019-04-03 22:22:45 +02:00
decabeza
f47ec9d7dc Fix hound warnings 2019-03-26 18:21:19 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
decabeza
bc1679550b Remove incoming polls filter 2019-02-08 14:28:19 +01:00
Juan Salvador Pérez García
7cdb0c8ebf Proposal related polls won't appear in votes section
Proposal related polls won't be shown in the public votes section.
2018-07-17 17:58:22 +02:00
rgarcia
b8dd93748f removes unnecessary code 2017-10-23 21:40:04 +02:00
María Checa
70a35fbe58 Poll views improvements
Reorganized poll `#show`,  `#stats` and `#results` views. Gave stats section its own route.
2017-10-18 18:35:53 +02:00
María Checa
35f24b519d Merge branch 'master' into 1786-poll_results 2017-10-18 17:33:16 +02:00
María Checa
55c15bca86 Added poll results route 2017-10-17 18:29:14 +02:00
iagirre
6a292daf42 Partial to render the polls stats and model methods to get the information from DB 2017-10-17 15:04:29 +02:00
Bertocq
916f9ba40b Correctly query and order poll question answers for description block 2017-10-13 12:44:55 +02:00
Bertocq
34c278db74 Small fixes for Poll Question Answer ordering 2017-10-11 12:05:20 +02:00
rgarcia
843048a861 cleans up 2017-10-10 12:14:04 +02:00
Raimond Garcia
2b588753ee Merge branch 'master' into mlucena-poll-comments 2017-10-09 17:59:12 +02:00
Bertocq
165509b525 Switch from Poll::Answer to Poll::Voter usage and small fixes 2017-10-06 18:59:47 +02:00
María Checa
35148015b9 Added token to poll voters 2017-10-06 18:43:00 +02:00
Bertocq
d4408efda6 Generate a unique token for a Poll Ballot and use it on answer buttons 2017-10-06 14:36:21 +02:00
Manuel Lucena
63cbe2f7c1 20171003 - [WIP] Functionality and tests for polls comments 2017-10-06 10:36:26 +02:00
kikito
964da1e6d6 Fixes rails autoloader error in development 2017-01-30 11:30:18 +01:00
kikito
55ace74c67 Shows geozones when listing polls 2017-01-30 11:30:08 +01:00
Juanjo Bazán
6bc4f5b307 adds Poll::Answer model for web users
PartialResults is kept for booth results
2017-01-25 12:46:44 +01:00
kikito
ddf8d5f811 Removes answerable/non_answerable questions in polls
Now they are either all answerable or non-answerable, so it is not
worth it to make the distinction in code
2017-01-24 18:10:13 +01:00
kikito
0c9e6db04d Implements answers in a partial 2016-11-11 19:10:11 +01:00
kikito
506cf0dd70 Refactors polls_controller using answerable_by. Implements more specs 2016-11-07 17:43:53 +01:00
kikito
35a5136d9f Implements filtering in polls/index 2016-11-03 17:52:15 +01:00
kikito
575aa62960 Starts introducing valid answers to poll questions 2016-10-31 16:31:48 +01:00
kikito
3eca3faacd First version of Polls Controller 2016-10-31 14:13:56 +01:00