Commit Graph

1875 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
700f271a36 Remove milestone overrided translation class
Since Globalize gem update to v5.2.0 we cannot override translations
anymore in the same way that before the update. Milestone::Translation
class removed in this commit were no longer loaded correctly when
translation class is retrieved by translation_class method provided by
Globalize. Here is the diff between both gem versions:

https://github.com/globalize/globalize/compare/v5.0.0...v5.2.0#diff-a1370b109e0dd567545b072bc6447b8fR51

This problem is not happening on test environment but is throwing an
exception in other environments as it has not loaded the delegation
definition inside our custom translation class.

To fix this we added a new class method inside globalizable model
concern to allow to define method delegation on translations classes from
parent globalizable classes when needed without having to override
Translation classes.

Another way to properly load our custom Milestone::Translation class is
to place it inside parent model class, like the example below:

class Milestone
...

  class Translation
    delegate :status_id, to: :globalized_model
  end
end

Or maybe monkey patching translation_class method from globalize gem
to make it find our custom translation class. I don't like this option.
2019-04-16 17:28:07 +02:00
Angel Perez
25f104d2dd Fix deprecation warning for .uniq usage 2019-04-16 17:28:07 +02:00
rgarcia
c979cc7411 Fix uniq deprecation warning
DEPRECATION WARNING: uniq is deprecated and will be removed from Rails
5.1 (use distinct instead) (called from block in <class:User> at
/home/travis/build/consul/consul/app/models/user.rb:67)
2019-04-16 17:28:07 +02:00
alejandro
596ff77ec1 replaces uniq with distinct
Uniq is deprecated
2019-04-16 17:28:07 +02:00
alejandro
84338592da removes devise-async for delayed devise emails
Custom overwrite of the devise implementation following
https://github.com/plataformatec/devise#activejob-integration
2019-04-16 17:28:07 +02:00
rgarcia
7e3eb4a6fc fixes expire cache specs 2019-04-16 17:28:07 +02:00
rgarcia
aeb84108bc Verify poll ballots 2019-04-10 18:29:01 +02:00
rgarcia
1eaa5cc77b stores the heading where the user has voted 2019-04-10 18:15:43 +02:00
María Checa
394177213c Adds Ballot Sheet model and business logic 2019-04-10 16:04:39 +02:00
Javier Martín
3ccdf039e4 Merge pull request #3344 from consul/backport-budget_ballots
Allow voting Budget Investments in booths
2019-04-09 13:54:00 +02:00
Javier Martín
3e46153a97 Merge pull request #3420 from consul/backport-fix_sort_by_random
Fix sort by random inconsistencies
2019-04-05 17:38:44 +02:00
lalo
237a03552f Move admin budget investments tabs filters to advanced filters component 2019-04-03 22:27:48 +02:00
decabeza
fcbb11b26e Hides question menu on budget poll and changes redirect when create 2019-04-03 22:23:32 +02:00
rgarcia
7dd314c699 Do not display polls associated to a budget in admin poll questions
This section is used to select to which poll a question belongs to.

Budget polls are not meant to include questions that come from Citizen
Proposals or Government Questions, thus we do not display them
2019-04-03 22:20:01 +02:00
Bertocq
dac0264b63 Prevent offline budget vote after voting online 2019-04-03 22:19:56 +02:00
rgarcia
aa7441271d Prevent balloting online after casting a ballot offline 2019-04-03 22:19:51 +02:00
rgarcia
20a3f6539d Add association between polls and budgets 2019-04-03 22:19:44 +02:00
Javier Martín
12bccf3fd0 Merge pull request #3364 from LextrendIT/3357_add_admin_investments_advanced_filter_for_max_supports
Add on admin budget investments an advanced filter for max supports
2019-04-03 21:39:15 +02:00
Javier Martín
d85743bf68 Merge pull request #3356 from LextrendIT/feature/module_15_extract_costs_from_admin_investments_feasability_column
Add price column in the admin budget investments table
2019-04-03 21:29:31 +02:00
Javi Martín
74088ac949 Make random IDs with the same seed consistent
The order of the array before being shuffled needs to be the same if we
want to have the same array after being shuffled with a certain seed.

We were using `pluck(:id)`, which doesn't guarantee the order of the
elements returned.

Replacing it with `order(:id).pluck(:id)` adds an `ORDER BY` clause and
so guarantees the order of the elements.
2019-04-03 21:21:11 +02:00
lalo
9edaf44b9c Add new admin budget investments advanced filter for max supports 2019-04-03 13:39:59 +02:00
lalo
0a5057a0a8 Add max support advanced filter for admin budget investments 2019-04-02 19:46:16 +02:00
Javi Martín
f7f9fc15a5 Move todays_booths_for_officer to the model
This way we can easily add a test which will fail if by accident we
change the method to use `Date.today`. Until now using `Date.today`
would only fail if we ran specs in a time zone with a different date.
2019-03-28 15:49:17 +01:00
Bertocq
31428a5847 Add booth and officing assigments presence validation for booth votes, unskip specs 2019-03-28 15:47:52 +01:00
rgarcia
b4499321d3 stores officer booth on sign in 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
kikito
10283c32ee Adds scopes to officer_assignment 2019-03-28 15:47:52 +01:00
Javi Martín
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
Javi Martín
58816aef5f Fix legislation process feed order
We need to add an ORDER BY clause; not doing so was causing different
processes to show up sometimes. As mentioned in the PostgreSQL manual:

> Because the order of the rows in the database table is unpredictable,
> when you use the LIMIT clause, you should always use the ORDER BY
> clause to control the order of rows. If you don’t do so, you will get
> an unpredictable result set.
2019-03-21 17:12:03 +01:00
Julian Herrero
89d4ea5aa3 Remove homepage widget settings from configuration tab
- Rename homepage widget settings keys
2019-03-19 19:45:34 +01:00
Julian Herrero
9ed6aae348 Refactor Setting model
- Make easier to group settings by using prefixes
- Add method to rename setting keys
- Add method to remove setting keys
2019-03-19 15:14:08 +01:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +01:00
rgarcia
8125d470de Add methods to obtain polls votable by a user 2019-03-06 17:42:46 +01:00
Alberto
098f4b6c5f Merge pull request #3328 from consul/admin-settings
Improve Admin settings section
2019-02-27 10:49:54 +01:00
Javi Martín
c5c56ad969 Use a virtual attribute to get valuation tags
It was strange to set the valuation tags using `valuation_tag_list=` but
then accessing the valuation tags using `tag_list_on(:valuation)`.
2019-02-26 14:16:10 +01:00
Javi Martín
4980819528 Fix valuation tags being overwritten
When params[:budget_investment][:valuation_tag_list] was not present,
which is the case when updating an investment using the "mark as visible
to valuators" checkbox, we were removing all valuation tags.

Using a virtual attribute to assign the tags only if the parameter is
present simplifies the code in the controller and avoids the issue.
2019-02-26 14:16:10 +01:00
Javier Martín
9fd3c4fb1c Merge pull request #3321 from consul/backport-fix_random_order
Fix random proposals order in the same session
2019-02-26 14:09:24 +01:00
decabeza
8066b96fe3 Remove legacy banner images and banner styles settings 2019-02-25 14:59:38 +01:00
decabeza
0d834744fd Replace open to active filter on admin legislation processes index
Now active filter show open processes and the next ones, processes with a start date greather than current date.
2019-02-20 13:32:09 +01:00
Javi Martín
6682121069 Reuse code to set and order by a random seed 2019-02-20 12:10:12 +01:00
Javi Martín
e3ca700e17 Add concerns to set and order by a random seed 2019-02-20 11:51:32 +01:00
Javi Martín
660c59016b Fix random proposals order in the same session
Using `setseed` and ordering by `RAND()` doesn't always return the same
results because, although the generated random numbers will always be
the same, PostgreSQL doesn't guarantee the order of the rows it will
apply those random numbers to, similar to the way it doesn't guarantee
an order when the `ORDER BY` clause isn't specified.

Using something like `reorder("legislation_proposals.id % #{seed}")`,
like we do in budget investments, is certainly more elegant but it makes
the test checking two users get different results fail sometimes, so
that approach might need some adjustments in order to make the results
more random.
2019-02-20 11:51:32 +01:00
Javier Martín
7c61f621e2 Merge pull request #3314 from consul/backport-without_valuator
Consider having valuator group as having valuator
2019-02-19 18:59:15 +01:00
Javier Martín
44483c2c32 Merge pull request #3313 from consul/backport-fix_literal_as_condition
Fix literal as condition
2019-02-18 18:58:47 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
Javi Martín
bd67fcb9cf Consider having valuator group as having valuator
So under the tab "without valuator" we don't show investments assigned
to a valuator group, just as expected by administrators.

There was a conflict while applying this commit to the CONSUL repo. I've
decided to re-introduce the test which was deleted in commit dddf026a,
which hadn't been deleted in AyuntamientoMadrid@192f1182.
2019-02-15 21:11:24 +01:00
Javi Martín
250b19b0d3 Remove literal used in condition
The right syntax would have been:

`after_save :recalculate_heading_winners, if: :incompatible_changed?`

However, since the method `recalculate_heading_winners` already executes
the `if incompatible_changed?` condition, removing it keeps the intended
behaviour.
2019-02-15 20:21:35 +01:00
Javier Martín
b330de01f6 Merge pull request #3148 from matisnape/budget_investments_sorting_columns
Add sort links to admin tables
2019-02-15 19:19:11 +01:00
Julian Nicolas Herrero
4a12425987 Merge pull request #3296 from consul/make_budgets_translatable
[Backport] Make budgets translatable
2019-02-13 19:01:13 +01:00
Julian Nicolas Herrero
e8c77f58a6 Merge pull request #3292 from consul/backport_delete_officer_assignment_with_associated_data
[Backport] Delete Booth Shifts with associated data
2019-02-13 18:56:43 +01:00