Commit Graph

1979 Commits

Author SHA1 Message Date
María Checa
c2457e36a5 Add budget stats permissions for normal users and admins 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
e0e02b47c0 Add Budgets Stats Controller, route and ability on reviewing ballots and finished budget 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
Juanjo Bazán
110ee961e3 adds budget stats for final voting to admin stats 2019-05-16 14:45:46 +02:00
Alberto
60c02cc19a Merge pull request #3466 from consul/admin-documents
Add document uploads from admin section
2019-05-10 17:57:22 +02:00
Javi Martín
574bd87b08 Remove unused (and flaky) card code and its spec
This code was introduced in commit 722a431b, but it stopped being used
in commit 7657a0e0.

The spec was failing sometimes because the method didn't order the
records, but the spec checked the records returned in a certain order.

Furthermore, the method `page` generated a potential conflict with
kaminari's `page method.
2019-05-10 15:21:58 +02:00
voodoorai2000
19b7526421 Add document upload from admin section 2019-04-30 11:59:08 +02:00
Javi Martín
c43b0fea64 Use Rails 5 conventions in Dashboard
These models and migrations were added on a branch based on Rails 4.
2019-04-29 13:08:43 -05:00
voodoorai2000
992f1d23a1 Change syntax to delay dashboard emails
After updating to Rails5 It seems the after_action[1] in the dashboard's mailer is not beind called.

Using this syntax the emails are still being delayed and the after_action being called correctly.

[1] https://github.com/AyuntamientoMadrid/consul/pull/1945/files#diff-fdf5590f3241c439fcc9d2225c3cf4d8R3
2019-04-29 15:44:45 +02:00
voodoorai2000
34834889d8 Fix Answer's class conflict
We have two models called `Answer`: The `Answer` model and the `Poll::Answer` model.

This conflict ocurrs when trying to create a user generated poll for a proposal. from the Dashboard. In that case we are getting an exception, only in the development environment, as the class `Answer` is loaded before the class `Poll::Answer` which is the one we want to use.

With this commit we are explicitly requiring the correct model, solving the class conflict.
2019-04-29 15:43:06 +02:00
decabeza
99023a01c9 Fix merge conflicts 2019-04-29 14:22:22 +02:00
decabeza
51ced318e0 Merge branch 'master' into proposal-dashboard 2019-04-29 13:48:23 +02:00
Javi Martín
4b1cbb7db6 Use Rails 5 conventions in ballot migrations
These migrations and models were added after the Rails 5 branch was
created but before it was merged.
2019-04-24 19:24:01 +02:00
decabeza
17d4af31ae Remove duplicated content on model poll 2019-04-24 14:00:58 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Julian Herrero
c9752e94be Change the way we retrireve the images urls
For some reason the paperclip method `attachment.exists?' was
returning nil even when `attachment.url(style)' was correctly
returning the url/path of the attachment.

Therefore returning `nil' was causing to raise an error in the
method `image_tag'.

With this change we make sure we return the image url it it's
available, or an empty string if it's not, but never a null value.
2019-04-17 17:40:56 +02:00
Julian Herrero
6e88031537 Fix several rubocop warnings
Metrics/LineLength: Line is too long.
RSpec/InstanceVariable: Use let instead of an instance variable.
Layout/TrailingBlankLines: Final newline missing.
Style/StringLiterals: Prefer double-quoted strings.
2019-04-17 17:40:56 +02:00
Julian Herrero
4b57c3d8eb Replace occurrences of ActiveRecord::Base on new models 2019-04-17 17:40:56 +02:00
Angel Perez
129411864e 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
Juanjo Bazán
1cec362ba7 fixes application_record parent 2019-04-17 17:40:56 +02:00
Juanjo Bazán
b7d9ef6377 models inherits from ApplicationRecord 2019-04-17 17:40:56 +02:00
Senén Rodero Rodríguez
aa3e8c8458 Keep method for not yet globalizable models
Maintain the method for models that are still translatable. This help
me to pass the CI build. In later PR's this method will be eliminated
as no one will invoke it.
2019-04-17 17:40:56 +02:00
Senén Rodero Rodríguez
0b3a3b97f7 Santitize description translations
Sanitize all not marked for destruction translations when description
is a translatable attribute.
2019-04-17 17:40:56 +02:00
Senén Rodero Rodríguez
a68098eaed Fix sanitization for translatable description attribute
Move method from sanitizable to globalizable concern because
globalize_accessors were overiding sanitizable method and was never
called. Another solution to this could be to load sanitizable
always after globalizable concern.

Old method implementation was not working well with globalize_accessors,
it was returning nil always.
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
rgarcia
b2b418284d Fix ActiveModel::Errors#[]= deprecation warning
DEPRECATION WARNING: ActiveModel::Errors#[]= is deprecated and will be
removed in Rails 5.1. Use model.errors.add(:attachment, "content type
image/png does not match any of accepted content types pdf") instead.
(called from validate_attachment_content_type at
/home/travis/build/consul/consul/app/models/document.rb:92)
2019-04-17 17:40:55 +02:00
rgarcia
930fc58173 fixes lock specs 2019-04-17 17:40:55 +02:00
rgarcia
1077a632cb permits parameters in urls 2019-04-16 17:28:07 +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
Julian Herrero
01a9ba4a87 Remove ProgressBar 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.
2019-04-16 17:28:07 +02:00
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