Commit Graph

461 Commits

Author SHA1 Message Date
Javi Martín
5d2f5d1d81 Move gender and age methods to a common concern
These are generic methods which only depend on the participants.
2019-05-21 13:49:42 +02:00
Javi Martín
ccaa2e1a77 Remove duplication to calculate percentage 2019-05-21 13:49:42 +02:00
Javi Martín
188278296c Simplify the way we cache stats 2019-05-21 13:48:54 +02:00
Javi Martín
d627215af4 Use symbols for method names 2019-05-21 13:27:03 +02:00
Javi Martín
313ffb589b Share method to generate stats 2019-05-21 13:27:03 +02:00
Javi Martín
62a97f9003 Add a common concern for budget and poll stats 2019-05-21 13:27:03 +02:00
María Checa
fac99cfb10 Add web and booth participants in budget stats 2019-05-16 22:01:42 +02:00
María Checa
3291b3274a Added physical votes to stats 2019-05-16 22:01:42 +02:00
Bertocq
4b2a2dd995 Improve percent round 2019-05-16 22:01:42 +02:00
Bertocq
be89289b09 Improve budget stats page with a new row showing each column totals 2019-05-16 22:01:42 +02:00
rgarcia
50c0f5f287 more efficient calculation of ballot lines 2019-05-16 22:01:42 +02:00
rgarcia
e5ec0bf6bb counts votes instead of ballots 2019-05-16 22:01:42 +02:00
Bertocq
cdece48898 Order Budget headings by id when calculating heading stats 2019-05-16 22:01:42 +02:00
Bertocq
1f3bc2c8d9 Switch from feasible to selected investments on budget stats 2019-05-16 22:01:42 +02:00
rgarcia
f9e45dc2e2 displays selected instead of feasible investments 2019-05-16 22:01:42 +02:00
rgarcia
ef958aae59 adds version to cache 2019-05-16 22:01:42 +02:00
Bertocq
132397b610 Add Budget Stats class 2019-05-16 22:01:42 +02:00
Bertocq
63631f29a8 Add ballot_lines_count counter_cache to ballot -> ballot line relationship 2019-05-16 22:01:42 +02:00
Julian Herrero
4b57c3d8eb Replace occurrences of ActiveRecord::Base on new models 2019-04-17 17:40:56 +02:00
Angel Perez
01c1ac2b10 Replace all occurrences of ActiveRecord::Base with ApplicationRecord 2019-04-17 17:40:56 +02:00
Juanjo Bazán
7ab602175a makes models inherit from ApplicationRecord 2019-04-17 17:40:56 +02:00
taitus
638c80760f Fix queries and scopes after column deletion
Some queries were accessing original column instead of the new translatable one. This should have been causing unexpected behavior for requests maded in a different locale than the application default.
2019-04-17 17:40:56 +02:00
taitus
fbfe5b3468 Fix specs heading_specs.rb:313 2019-04-17 17:40:55 +02:00
Senén Rodero Rodríguez
596ef8d1ed Fix queries and scopes after column deletion
Some queries were accessing original column instead of the new
translatable one. This should have been causing unexpected behavior
for requests maded in a different locale than the application default.
2019-04-17 17:40:55 +02:00
alejandro
ceea0d4a36 sanitizes params for views 2019-04-17 17:40:55 +02:00
Julian Herrero
dc88212b75 Remove Budget::Phase 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.0diff-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.

Since module Sanitizable takes care of traslations, it's enough to
include the module in order to correctly sanitize the description.
2019-04-16 17:28:07 +02:00
Julian Herrero
aa0b48badd Remove Budget::Heading 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.0diff-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.
2019-04-16 17:28:07 +02:00
Julian Herrero
9a15f3d160 Remove Budget 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.0diff-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.
2019-04-16 17:28:07 +02:00
Julian Herrero
e104369b67 Remove Budget::Group 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.0diff-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 Translation class is
to place it inside parent model class.
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
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
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
lalo
237a03552f Move admin budget investments tabs filters to advanced filters component 2019-04-03 22:27:48 +02:00
rgarcia
aa7441271d Prevent balloting online after casting a ballot offline 2019-04-03 22:19:51 +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
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
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
Julian Herrero
3ba961a2d7 Use double quotes in models 2019-03-14 17:25:43 +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
Javi Martín
6682121069 Reuse code to set and order by a random seed 2019-02-20 12:10:12 +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
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 Herrero
a963a99c55 Use correct scope to sort headings by name 2019-02-13 13:35:09 +01:00