Commit Graph

33 Commits

Author SHA1 Message Date
taitus
ecde8c6439 Add lambda to the validations that use model constants
In this way when we need modify the constants model value in the
model/custom folder, adding lambda it will be possible load the new
values.
2022-03-22 15:52:36 +01:00
Javi Martín
096f546c24 Make sure users only vote once in the same poll
When skipping verification, we cannot apply the validation rule saying
the document number and document type must be unique, because they'll be
`nil` in many cases. So we were skipping the rule, but that makes it
possible for the same user to vote several times (for instance, once in
a booth and once via web).

So we're changing the scope of the uniqueness rule: instead of being
unique per document number, voters are unique per user. The reason we
made them unique per document number was that back in commit 900563e3
(when we added the rule), we hadn't added the relation between users and
poll voters yet.
2020-08-07 13:40:25 +02:00
decabeza
4367b2054a Allow voting when skip verification is enabled 2020-08-07 11:52:24 +02:00
Javi Martín
216d9e61dc Remove unused Voter methods
AFAIK these methods were never used. In any case, the similar method
`set_demographic_info` was added in commit 6c34599e.
2019-11-10 00:34:45 +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
93c6347b45 Apply Rails/FindBy rubocop rule
We were already using it in most places.
2019-10-23 18:29:09 +02:00
Javi Martín
9fe8c47528 Apply Rails/SafeNavigation rubocop rule 2019-09-10 21:43:39 +02:00
Bertocq
118cce2f8f Add letter origin back to poll voters 2019-05-21 13:26:44 +02:00
Juanjo Bazán
7ab602175a makes models inherit from ApplicationRecord 2019-04-17 17:40:56 +02:00
Bertocq
31428a5847 Add booth and officing assigments presence validation for booth votes, unskip specs 2019-03-28 15:47:52 +01:00
kikito
34dfeee9c9 Denormalizes booth_assignmen on the models where it is needed 2019-03-28 15:47:52 +01:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
Bertocq
ce0a7f6fad Rubocop autocorrections 2017-10-17 22:00:00 +02:00
Bertocq
e928eb38ac Add Officer relationship to Poll Voter 2017-10-04 00:39:31 +02:00
rgarcia
0147401fbe adds origin to poll voters 2017-10-02 16:18:08 +02:00
María Checa
089c690b49 Created new entry point CensusCaller
Here's a better alternative than the first one. Added a new abstraction level from which are performed both types of census calls, while the logic of those is managed in their own library.
2017-07-10 12:22:30 +02:00
Bertocq
b79df113cd Switch all Time.curren.to_date for Date.current, same result but better syntax 2017-06-11 10:41:09 +02:00
Bertocq
02524b164a Rubocop autocorrections (indentations, revers unless to if, extra spaces) 2017-06-08 12:14:35 +02:00
Bertocq
9e74249b02 Always use Time.current (aliases internally to Time.zone.now)
Some specs where breaking close to midnight because 30.years.ago uses zone.now and Time.now.utc.to_date doesn't.
Also this will make all codebase consistent in the way time is deal with
2017-05-24 07:54:57 +02:00
rgarcia
22b0cb0346 removes poll voter demographic validations 2017-02-01 14:25:08 +01:00
rgarcia
ea701e9963 fixes conflicts with polls 2017-01-29 00:44:56 +01:00
rgarcia
6c34599e1e adds officer residence check and user voting 2017-01-29 00:36:20 +01:00
Juanjo Bazán
cf6ca50a3b adds optional officer_assignment_id to poll::voters 2017-01-27 18:39:25 +01:00
Juanjo Bazán
51be80eedc removes answer <-> voter association 2017-01-27 11:59:37 +01:00
Juanjo Bazán
cc6d841978 refactors age calculation 2017-01-25 17:16:17 +01:00
Juanjo Bazán
086f4a4170 refactors Poll::Voter 2017-01-25 14:19:36 +01:00
Juanjo Bazán
900563e31c adds poll_id and stats fields to poll_voters 2017-01-25 12:03:48 +01:00
Juanjo Bazán
bdf16395d3 removes poll_id from voter
YAGNI
2016-12-07 19:11:43 +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
5b424d1793 updates query to be more efficient 2016-11-14 13:56:49 +01:00
rgarcia
b54aee5702 displays voter name if already voted 2016-11-14 13:52:38 +01:00
rgarcia
8dc7285681 validates user has not already voted 2016-11-14 13:52:38 +01:00
rgarcia
44df91346a validates voter in census 2016-11-14 13:51:59 +01:00