Commit Graph

30 Commits

Author SHA1 Message Date
Javi Martín
38b38d1fcc Rename Poll::Question::Answer to Poll::Question::Option
Having a class named `Poll::Question::Answer` and another class named
`Poll::Answer` was so confusing that no developer working on the project
has ever been capable of remembering which is which for more than a few
seconds.

Furthermore, we're planning to add open answers to polls, and we might
add a reference from the `poll_answers` table to the
`poll_question_answers` table to property differentiate between open
answers and closed answers. Having yet another thing named answer would
be more than what our brains can handle (we know it because we did this
once in a prototype).

So we're renaming `Poll::Question::Answer` to `Poll::Question::Option`.
Hopefully that'll make it easier to remember. The name is also (more or
less) consistent with the `Legislation::QuestionOption` class, which is
similar.

We aren't changing the table or columns names for now in order to avoid
possible issues when upgrading (old code running with the new database
tables/columns after running the migrations but before deployment has
finished, for instance). We might do it in the future.

I've tried not to change the internationalization keys either so
existing translations would still be valid. However, since we have to
change the keys in `activerecord.yml` so methods like
`human_attribute_name` keep working, I'm also changing them in places
where similar keys were used (like `poll_question_answer` or
`poll/question/answer`).

Note that it isn't clear whether we should use `option` or
`question_option` in some cases. In order to keep things simple, we're
using `option` where we were using `answer` and `question_option` where
we were using `question_answer`.

Also note we're adding tests for the admin menu component, since at
first I forgot to change the `answers` reference there and all tests
passed.
2024-06-13 19:13:01 +02:00
Javi Martín
a1439d0790 Apply Layout/LineLength rubocop rule
Note we're excluding a few files:

* Configuration files that weren't generated by us
* Migration files that weren't generated by us
* The Gemfile, since it includes an important comment that must be on
  the same line as the gem declaration
* The Budget::Stats class, since the heading statistics are a mess and
  having shorter lines would require a lot of refactoring
2023-08-30 14:46:35 +02:00
Javi Martín
5b6de96241 Add and apply MultilineMethodCallIndentation rule 2023-08-18 14:56:16 +02:00
Javi Martín
09c63e354c Add and apply Layout/DotPosition rule
Since IRB has improved its support for multiline, the main argument
towars using a trailing dot no longer affects most people.

It still affects me, though, since I use Pry :), but I agree
leading dots are more readable, so I'm enabling the rule anyway.
2023-08-18 14:56:16 +02:00
Javi Martín
884fd2b27b Add and apply Rails/WhereEquals rubocop rule
We were already following this style in most places.
2021-08-09 23:52:47 +02: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
a727dcc031 Apply Style/SymbolProc rubocop rule
This style is much more concise.
2019-10-26 20:10:32 +02:00
Javi Martín
d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +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
María Checa
ccf8d3a8e2 Adds ballot sheets controller and main views 2019-04-10 16:03:47 +02:00
Bertocq
80a9ba8aa7 Enable and fix booth selection back 2019-03-28 15:47:52 +01:00
Bertocq
77930d3275 Enable officing panel booth selection back 2019-03-28 15:47:52 +01:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
BertoCQ
c6d683083f Merge pull request #2073 from consul/feature/2072#remove_question_valid_answers
Remove valid answers usage
2017-10-18 11:52:14 +02:00
Bertocq
e9294f2a22 Switch from valid_answers to question_answers usage for Poll Questions 2017-10-18 01:32:15 +02:00
Bertocq
ce03251c72 Filter officing results officer assigments to current date 2017-10-17 23:15:26 +02:00
Bertocq
04910fea5b Remove officing results date picker for current date 2017-10-17 21:00:19 +02:00
Bertocq
45831a0b68 Include last day of poll in range for recount and scrutiny on officing panel 2017-10-03 18:56:27 +02:00
Bertocq
b5cf28cb35 Swap Poll White/Null/Total usage for Poll Recount 2017-10-02 15:46:49 +02:00
Bertocq
5129fc83a8 Use next to go for next iteration instead than surrounding if 2017-09-25 22:47:03 +02:00
Bertocq
e8d748a881 Add Poll Total recount to officing and admin 2017-09-14 15:33:58 +02:00
Bertocq
69f4e1c683 Fix all rubocop Metrics/LineLength issues (140+) 2017-07-10 13:22:49 +02:00
Juanjo Bazán
58b1ad950a fix bug storing null results as white results 2017-02-18 12:11:49 +01:00
Juanjo Bazán
2a902c68eb adds creation of null and white results by poll officers 2017-02-03 19:11:04 +01:00
Juanjo Bazán
eed03d0e0e show existing results also on creation error 2017-02-02 16:11:15 +01:00
Juanjo Bazán
ec8d45f3cd adds index view for poll results in officing 2017-02-02 16:10:40 +01:00
Juanjo Bazán
592fdffe4e adds results creation by poll officers 2017-02-02 14:44:44 +01:00
Juanjo Bazán
594ad3df7b adds basic new view for officing results 2017-02-02 11:53:57 +01:00
Juanjo Bazán
0953a536af adds recounting to officing 2017-01-03 22:23:54 +01:00
rgarcia
503338e47b adds view placeholders for officing polls 2016-11-14 13:51:09 +01:00