Commit Graph

32 Commits

Author SHA1 Message Date
Javi Martín
9491b20314 Extract method to get vote counts by votable type 2023-08-30 14:46:34 +02:00
Javi Martín
b536a7cb77 Extract component for supporting budget admin stats
This is consistent with the component for balloting stats. We're about
to change both components, and the changes are easier to follow if
they're similar.

We're also using consistent names in methods.
2023-02-20 14:21:22 +01:00
Javi Martín
76b08398cf Extract component for balloting budget admin stats
We're also moving the tests, but we're keeping one system test in order
to test the controller and the navigation to get to this page.

Note we're slightly changing the order of the methods in the component;
the order of the instance variables was `user_`, `vote_`, `vote_`,
`user_`, which was hard to follow.
2023-02-20 14:20:50 +01:00
Javi Martín
69dda19af7 Add and apply Rails/PluckId rubocop rule 2021-08-09 23:52:47 +02:00
Senén Rodero Rodríguez
9b2d349e21 Create SDG stats page 2021-01-23 12:23:29 +01:00
Javi Martín
4658e18db5 Re-add and apply Rails/UniqBeforePluck rule
We removed it in commit d639cd58 because it recommended using `uniq`
where `distinct` was more appropriate. This has been fixed in
rubocop-rails 2.6.0.
2020-10-26 11:26:34 +01: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
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
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
Julian Herrero
fd71ed825b Avoid error when accessing final votes stats before balloting phase
When accessing the URL `/admin/stats/budget_balloting?budget_id=X'
for a budget in a phase prior to the balloting phase, the following
error was raised due to the stats where not calculated yet.
Instead, we'll now show a flash message.

NoMethodError:
  undefined method `[]' for nil:NilClass
  ./app/controllers/admin/stats_controller.rb:82
2019-06-10 17:28:16 +02:00
voodoorai2000
d0b8fef6b3 Delete spending proposals 2019-05-31 18:22:59 +02:00
Juanjo Bazán
110ee961e3 adds budget stats for final voting to admin stats 2019-05-16 14:45:46 +02:00
Juanjo Bazán
5be54b57da reduces current admin budget stats as supporting phase 2019-05-16 14:45:45 +02:00
rgarcia
11437a1d40 add budget investment stats 2019-05-16 13:41:49 +02:00
rgarcia
cfe3f95f5c moves graphs to individual views 2019-05-16 13:37:47 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Angel Perez
9029acd440 Fix Rubocop warnings for Admin controllers [ci skip] 2018-09-07 13:59:07 -04:00
Bertocq
c0dcd03bab Prevent valuation comments from appearing in public pages 2018-01-31 18:14:11 +01:00
iagirre
5a3e701e8d Polls' stats migrated from Madrid's fork and sortable functions added for tables 2017-10-23 13:19:22 +02:00
rgarcia
b1fa2d22f7 only count active users in stats 2017-06-13 12:59:04 +02:00
Alberto Garcia Cabeza
60d08ab565 improves query on admin stats controller 2017-04-26 13:12:55 +02:00
Alberto Garcia Cabeza
45af9ce5aa adds budget investments numbers and chart on admin stats 2017-04-25 16:46:20 +02:00
rgarcia
bb3c4c6399 adds consistency to ruby code style
Keep a blank line before and after private
Keep a blank line before and after protected
Remove extra empty line at class body end
Remove extra blank line
Add final newline
Use 2 (not 3) spaces for indentation
Use 2 (not 4) spaces for indentation
Remove space before comma
Add space after comma
Remove trailing whitespaces
Remove unnecessary spacing
Use snake_case for variable names
Do not use then for multi-line if
Remove unused block argument - i
Use the new Ruby 1.9 hash syntax
Remove unused assignment to variable
Indent when as deep as case
Align attributes
Align end with def
2016-11-15 11:18:43 +01:00
rgarcia
3c2098eb14 improves legibility of counts 2016-06-16 18:40:05 +02:00
rgarcia
b7e3129ec1 uses more efficient count 2016-06-16 18:35:34 +02:00
rgarcia
0abc9c8376 adds stats for direct messages and proposal notifications 2016-06-16 17:42:16 +02:00
Juanjo Bazán
65335d1344 optimizes stat query 2016-05-20 11:05:10 +02:00
palomahnhp
bf5d253e12 Merge branch 'master' into tracking_user_verifications_and_others
Conflicts:
	app/controllers/admin/stats_controller.rb
	db/dev_seeds.rb
2016-04-20 11:44:33 +02:00
inobcr
e2610e15e7 Add_stats_for_Investment_Proyect_#918 2016-03-21 18:18:18 +01:00
palomahnhp
7d4936b577 track user verification and add statistics of verified users who did not vote proposals 2016-03-13 21:38:05 +01:00
rgarcia
dc52271881 displays stats summary 2015-09-26 13:07:21 +02:00
Juanjo Bazán
8c99c6a5f0 refactors stats and optimizes js
JS libraries for stats (d3, c3, etc.) only load now when needed (stats/show)
2015-09-23 19:37:24 +02:00