Commit Graph

32 Commits

Author SHA1 Message Date
decabeza
36e452437e Add questions with mutiple answers to polls public interface
The `reload` method added to max_votes validation is needed because the
author gets here with some changes because of the around_action
`switch_locale`, which adds some changes to the current user record and
therefore, the lock method raises an exception when trying to lock it
requiring us to save or discard those record changes.
2022-10-18 11:04:40 +02:00
Senén Rodero Rodríguez
bd58023a8a Extract polls questions answers partial into a component 2022-10-17 18:03:36 +02:00
Senén Rodero Rodríguez
527d5691f7 Make poll feature work in browsers with javascript disabled
By using the Rails `button_to` helper (which generates a form), and adapting the
response to `html` and `js` formats, the feature works with or without javascript
enabled.
2022-09-22 17:39:57 +02:00
Senén Rodero Rodríguez
64676be246 Remove token column from poll_voters table
As it is no longer used as originally pretended [1][2].

[1] Check consul/consul pull request 1994
[2] Check consul/consul pull request 3539
2022-09-22 10:34:07 +02:00
Javi Martín
24ccf23ed8 Don't save the answer if the voter is not recorded
Up until now, we were assuming the voter was valid, but were not raising
an exception if it wasn't. And in the user interface everything seemed
to be working properly.

We were having this issue when skipping verification, when there could
be voters without a document number, which would be considered invalid.

Raising an exception when failing to save the voter and making sure the
answer and the voter are saved inside a transaction solves the problem.
2020-08-07 11:52:24 +02: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
a727dcc031 Apply Style/SymbolProc rubocop rule
This style is much more concise.
2019-10-26 20:10:32 +02: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
a5ba13b599 Apply Rails/Presence rubocop rule 2019-09-10 21:43:38 +02:00
Javi Martín
f9ed186909 Add rubocop spacing rules
We were following these rules in most places; we just didn't define them
anywhere.
2019-09-10 21:04:56 +02:00
lalo
c6e4b2480f Add public changes to create and vote Poll:Questions with votation type 2019-06-12 19:44:14 +02:00
Bertocq
b8dbdaf9a7 Move question most voted answer from boolean to a enumerable max by total_votes 2019-05-21 13:26:44 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Bertocq
a34118dbb0 Fix Lint/ShadowingOuterLocalVariable rubocop issue 2017-11-13 02:23:49 +01:00
María Checa
dfa8f4590a Most voted fix 2017-10-20 16:57:41 +02:00
María Checa
9bbf0b1ef9 Improved most_voted method 2017-10-20 16:48:54 +02:00
BertoCQ
6a0197a61b Merge branch 'master' into feature/1985#voting_token 2017-10-07 10:46:13 +02:00
Bertocq
81f65f1ac9 Touch answer model to force the updated_at value update 2017-10-06 19:57:52 +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
rgarcia
4aaf681d2d uses new answer model in user facing interface 2017-10-04 17:45:51 +02:00
María Checa
5bb831e959 Removed poll question show 2017-10-03 19:11:39 +02:00
Senén Rodero Rodríguez
f6fba64012 Remove uneeded document and image initializations 2017-09-26 13:57:14 +02:00
María Checa
4af44a45a1 Documents upload for questions working 2017-09-06 12:00:46 +02: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
6bc4f5b307 adds Poll::Answer model for web users
PartialResults is kept for booth results
2017-01-25 12:46:44 +01:00
Juanjo Bazán
91d5934567 removes unused code 2016-12-07 14:50:09 +01:00
rgarcia
4955daf886 adds poll and poll question's specs 2016-11-17 22:48:00 +01:00
rgarcia
d9ad658758 adds admin interface for poll questions 2016-11-17 09:30:42 +01:00
rgarcia
6fe965a9b8 adds question's show 2016-11-16 19:41:29 +01:00
kikito
1f9945d0aa Implements answering questions 2016-11-14 13:36:00 +01:00
kikito
219e139efb Adds poll_partial_result factory 2016-11-11 19:10:56 +01:00