Javi Martín
49f4a53569
Remove duplication in web percentage stats
...
We didn't use metaprogramming from the start because the
`null_percentage_web` method had a particular behaviour.
However, the behaviour (due to a typo) didn't really matter because
there are no null web votes, and so the `null_percentage_web` is always
zero.
2019-05-21 13:50:16 +02:00
Javi Martín
a552645e7f
Add tests to poll stats
...
While we already had "one test to rule all stats", testing each method
individually makes reading, adding and changing tests easier.
Note we need to make all methods being tested public. We could also test
them using methods like `stats.generate[:total_valid_votes]` instead of
`stats.total_valid_votes`, but then the tests would be more difficult to
read.
2019-05-21 13:50:16 +02:00
decabeza
70dbbbd1b9
Add stack class to polls stats table
...
This class improve tables layout on mobile screen sizes.
2019-05-21 13:50:16 +02:00
decabeza
1975b6ae7c
Remove sticky on polls stats links
2019-05-21 13:50:16 +02:00
Javi Martín
4d520a3a47
Rename age_groups method
...
The name was confusing because it seemed to return a list of age groups.
2019-05-21 13:50:16 +02:00
Javi Martín
c4c0301f3f
Simplify stats images styles
...
This way we don't need to manually define the width we think the image
we insert in the `::before` pseudoclass is going to take.
2019-05-21 13:50:16 +02:00
Javi Martín
4ade857a1b
Extract method to render number and info
...
We're going to use it in many places, so removing duplication is useful.
2019-05-21 13:50:16 +02:00
Javi Martín
1c9552b922
Add number-with-info HTML class to stats
...
So it can be reused in advanced statistics.
2019-05-21 13:50:16 +02:00
Javi Martín
573e04ef8f
Move common stats to partials
2019-05-21 13:50:16 +02:00
Javi Martín
88daaee9fe
Simplify code
2019-05-21 13:50:16 +02:00
Javi Martín
7dbe1dce86
Refactor web and booth votes calculations
2019-05-21 13:50:16 +02:00
Javi Martín
0e2e5a27c3
Refactor valid, white and null votes calculations
2019-05-21 13:50:16 +02:00
Javi Martín
f7d4507ebe
Keep sticky elements after AJAX requests
...
Turbolinks doesn't get on well with Foundation's Sticky, and so we need
to manually trigger the event on Turbolinks' `page:load`.
2019-05-21 13:50:16 +02:00
Javi Martín
b4a1f0db51
Rename file to initialize Foundation
...
Naming it "Dropdown" was misleading.
2019-05-21 13:50:16 +02:00
decabeza
b91b766e96
Adds styles and updates html markup to stats
2019-05-21 13:50:16 +02:00
Javi Martín
7ce57f649f
Use a <meter> tag to display age percentages
2019-05-21 13:50:16 +02:00
Javi Martín
0037ce5546
Reorder poll stats method names
...
So related methods are on the same line.
2019-05-21 13:50:16 +02:00
Javi Martín
57a2945590
Use let for stats in budget stats spec
...
The rest of the `before` block still uses instance variables, but at
least the rest of the file doesn't use instance variables anymore.
2019-05-21 13:50:15 +02:00
Javi Martín
1a1ca13525
Add age stats to polls
2019-05-21 13:50:15 +02:00
Javi Martín
9a01ff5323
Refactor age groups method
...
We try to make the method return data which is easier to handle in the
view.
2019-05-21 13:50:15 +02:00
Javi Martín
be68c8cdbf
Add gender stats to polls
2019-05-21 13:50:15 +02:00
Javi Martín
c0044f4e56
Extract method to show stats percentage
2019-05-21 13:50:15 +02:00
Javi Martín
80486b8193
Use section tags in stats
...
This way we can easily see the h3 tag's parent is the h2 tag.
2019-05-21 13:50:15 +02:00
Javi Martín
5a3eb70a46
Use same translations for poll and budget stats
2019-05-21 13:50:15 +02:00
Javi Martín
afa8bf8dba
Add basic headings and navigaton styles for stats
2019-05-21 13:50:15 +02:00
Javi Martín
c1b76a7ebf
Simplify age groups method
2019-05-21 13:50:15 +02:00
Javi Martín
c2489e3209
Increase number of age groups
...
We would now like to differenciate between 70-year-old people and
90-year-old people.
2019-05-21 13:50:15 +02:00
Javi Martín
e4a032ee68
Split common and specific stats methods
2019-05-21 13:49:42 +02:00
Javi Martín
1a86f7dbe8
Simplify total participants view logic
2019-05-21 13:49:42 +02:00
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
04c920c27d
Simplify calculate percentage method
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
voodoorai2000
40b9d658d7
Bring back deploy-secrets.yml.example
...
It was accidentally removed in this PR[1] and it is necessary to help in the capistrano configuration.
[1] https://github.com/consul/consul/pull/3412/files#diff-e2e7e59de6b2b5c76f396a862c48ccc5L1
2019-05-21 13:46:48 +02:00
Javier Martín
cbfa2c1df8
Merge pull request #3504 from consul/backport-poll_slugs
...
Add slug to polls
2019-05-21 13:42:47 +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
Bertocq
b8dbdaf9a7
Move question most voted answer from boolean to a enumerable max by total_votes
2019-05-21 13:26:44 +02:00
Bertocq
84eac6ff68
Correct booth valid and total participants calculations
2019-05-21 13:26:44 +02:00
Bertocq
b2b5ab1d48
Calculate white votes percentage of the total
2019-05-21 13:26:44 +02:00
Bertocq
4be44835a8
Add calculate_percentaje helper function to stats helper
2019-05-21 13:26:44 +02:00
Bertocq
f4260788eb
Add Partial Results counts to question answers
2019-05-21 13:26:44 +02:00
Bertocq
ba9346162c
Improve officing result specs
2019-05-21 13:26:44 +02:00
Bertocq
dbe404d9ad
Fix Officer final recount access without voting shift
2019-05-21 13:26:44 +02:00
decabeza
607b2362a3
adds missing id
2019-05-21 13:26:44 +02:00
Bertocq
118cce2f8f
Add letter origin back to poll voters
2019-05-21 13:26:44 +02:00
Javi Martín
e461c8d0ac
Generate navigation links for polls without a slug
2019-05-21 13:04:26 +02:00
Alberto
1c10c22b08
Merge pull request #3509 from consul/menu-users
...
Users menu
2019-05-21 12:54:42 +02:00
Alberto
0b437d65fc
Merge pull request #3508 from consul/admin-ui
...
Improve help texts on Admin UI
2019-05-21 12:53:43 +02:00