Commit Graph

25 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
Andrew Sims
95c82d8777 Changes following PR review
* Internationalisation for admin fields
* Correct typos
* Additional tests
* Replace ternary with if-then statement
2020-04-09 07:11:53 +10:00
Cassiano Sampaio
1e4f539104 Add title to differentiate signature sheets 2020-04-09 07:11:52 +10:00
Javi Martín
8e3bfa0d72 Apply Style/RedundantReturn rubocop rule
We were already following this pattern most of the time.
2019-10-26 13:26:35 +02:00
Javi Martín
8b5cca746c Apply rubocop rules to freeze constants
Added by popular demand among our team members.
2019-10-26 13:21:36 +02:00
Javi Martín
eafb4018bf Apply Style/CollectionMethods rubocop rule
We were already using `map` and `reduce` almost everywhere.
2019-10-26 13:03:49 +02:00
Javi Martín
fda53a0a2a Remove unnecessary foreign_key options
When we specify `belongs_to :author`, ActiveRecord automatically uses
`author_id` as the foreign key.
2019-10-25 19:03:10 +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
7ca55c44e0 Apply Rails/SaveBang rubocop rule
Having exceptions is better than having silent bugs.

There are a few methods I've kept the same way they were.

The `RelatedContentScore#score_with_opposite` method is a bit peculiar:
it creates scores for both itself and the opposite related content,
which means the opposite related content will try to create the same
scores as well.

We've already got a test to check `Budget::Ballot#add_investment` when
creating a line fails ("Edge case voting a non-elegible investment").

Finally, the method `User#send_oauth_confirmation_instructions` doesn't
update the record when the email address isn't already present, leading
to the test "Try to register with the email of an already existing user,
when an unconfirmed email was provided by oauth" fo fail if we raise an
exception for an invalid user. That's because updating a user's email
doesn't update the database automatically, but instead a confirmation
email is sent.

There are also a few false positives for classes which don't have bang
methods (like the GraphQL classes) or destroying attachments.

For these reasons, I'm adding the rule with a "Refactor" severity,
meaning it's a rule we can break if necessary.
2019-10-23 14:39:31 +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
Javi Martín
b5b07bccd3 Apply PercentLiteralDelimiters rubocop rule 2019-09-10 20:02:15 +02:00
taitus
d07f9312e5 Allow any configuration of required fields
- Add the methods "parse_date_of_birth" and "parse_postal_code"
  to recover the correct position of their values depending on the
  configuration of the remote census.
2019-07-29 13:10:09 +02:00
taitus
0bf88abcf1 Allow to SignatureSheet parse new fields
- In the previous version, each signature was equivalent to a document
  and we separated them by commas.
  Now each signature may also need the fields birth date and postal code.
  So we separated each signature with a semicolon and separated each of
  its fields by commas.
  Example old version: "12345678X, 87654321Y"
  Example new version:
  "12345678X, 31/12/1980, 28001; 87654321Y, 31/12/1981, 28002"

- Update translations:
 "Write the numbers separated by commas (,)" to
 "Write the numbers separated by semicolons (;)"
2019-07-29 13:10:09 +02:00
taitus
837c45599d Rename SignatureSheet column
This new functionality will allow to retrieve in the signature sheet
the document number, the date of birth and the postal code.

So we renamed :document_numbers to :required_fields_to_veriry to
clarify and adjust the name to its use.
2019-07-29 13:10:09 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Juanjo Bazán
7ab602175a makes models inherit from ApplicationRecord 2019-04-17 17:40:56 +02:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
Bertocq
2888c20489 Fix all Style/RedundantSelf rubocop issues 2017-07-05 11:55:52 +02:00
Bertocq
02524b164a Rubocop autocorrections (indentations, revers unless to if, extra spaces) 2017-06-08 12:14:35 +02:00
Juanjo Bazán
83e2df7410 adds signature sheets for budget investments 2017-04-05 12:59:42 +02:00
rgarcia
122446ef62 find or create signatures in case of a timeout 2016-12-28 11:41:52 +01:00
rgarcia
113c4551aa makes signatures aware of spaces between numbers and letter 2016-12-28 11:40:36 +01:00
rgarcia
675081141c refactors signatures 2016-12-21 18:46:31 +01:00
rgarcia
4eb700e3d4 refactors signature sheets 2016-12-20 16:46:08 +01:00
rgarcia
3c682b8a9b adds signature sheets 2016-12-20 12:21:05 +01:00