Commit Graph

5807 Commits

Author SHA1 Message Date
Javi Martín
354b183e17 Create reports
This table will store which reports (stats, results, ...) will be shown
for a certain process (polls, budgets, ...).

Note Rails fails to save a poll and its report when both are new records
if we add a `validate :process, presence: true` rule. Since it caused a
lot of trouble when creating records for tests during factories rule
completely. Instead, I've created the `results_enabled=` and
`stats_enabled=` methods, so tests are easier to set up, while also
automatically creating a report if it doesn't already exist. This also
decouples form structure and database implemenation.

Originally I named this table `enabled_reports` and instead of having
`stats` and `results` columns, it had an `enabled` column and a `kind`
column, which would be set to "stats" or "results". However, although
that table would allow us to add arbitrary reports easily, I found the
way we had to handle the `has_many` relationship was a bit too complex.
2019-05-22 11:50:03 +02:00
Alberto
ac1d8195f2 Merge pull request #3488 from consul/basic-yml
Admin basic customization texts
2019-05-21 21:43:07 +02:00
Javier Martín
82e3c41aa9 Merge pull request #3512 from consul/backport-stats
Change stats layout
2019-05-21 17:18:47 +02:00
decabeza
a2cb7501f7 Create new basic tab for admin information texts 2019-05-21 14:06:58 +02:00
Javi Martín
13dd77dd1b Add tasks to generate and expire stats cache
We're generating stats every 2 hours because it's less than the time it
will take to generate stats for every process. Once stats are generated,
this task should take less than a second.

The regenerate task has been added so we can manually execute it.
2019-05-21 13:50:19 +02:00
Javi Martín
944bd2d418 Don't capitalize common nouns 2019-05-21 13:50:19 +02:00
Javi Martín
66ecb2835b Show only available budget stats phases
This way we can show statistics for the supports phase before the vote
phase is over.
2019-05-21 13:50:18 +02:00
Javi Martín
e146fafb60 Only show "no demographic data" when necessary
If there's demographic data for all participants, it doesn't make sense
to show the message.

We're using translations instead of an `if` in the view because the text
is also different when there's only one participant. In some languages
the text might also be different depending on how many people with no
demographic data participated.

Another possibility would be to use an `if` in the view so we don't
display an empty paragraph when the cont is zero, and then using
translation for `one` and `other`. I haven't gone that way because I
thought the logic would be more complex and the benefits wouldn't be
that great.
2019-05-21 13:50:18 +02:00
Javi Martín
ae4cd06c24 Include no geozone in no demographic data 2019-05-21 13:50:18 +02:00
Javi Martín
558070d530 Remove geozone participation percentage
We currently don't store geozone population.
2019-05-21 13:50:18 +02:00
Javi Martín
4843959c7d Use poll voters valid origins as stats channels
They're the same thing, and duplicating them led into a typo saying
"mail" instead of "letter".
2019-05-21 13:50:18 +02:00
Javi Martín
eba30d1585 Use "Fully blank" instead of "white votes"
We were mistranslating the Spanish word "blanco", which can mean "blank"
or "white".

We've also decided to use "fully blank" because polls may have many
questions, and only votes leaving everything blank count as blank votes.
2019-05-21 13:50:18 +02:00
Javi Martín
e3063cd24f Remove complex poll stats
For now we think showing them would be showing too much data and it
would be a bit confusing.

I've been tempted to just remove the view and keep the methods in the
model in case they're used by other institutions using CONSUL. However,
it's probably better to wait until we're asked to re-implement them, and
in the meantime we don't maintain code nobody uses. The code wasn't that
great to start with (I know it because I wrote it).
2019-05-21 13:50:17 +02:00
decabeza
f6701373c4 Change i18n participation to participants 2019-05-21 13:50:17 +02:00
Javi Martín
dc077bb03c Simplify budget stats in voting phase
So we only show the total number of participants, and not divided by web
participants and booth participants.
2019-05-21 13:50:17 +02:00
Javi Martín
bc056d907e Add missing translation 2019-05-21 13:50:17 +02:00
Javi Martín
2d7b8bc8df Use new design for advanced budget stats 2019-05-21 13:50:17 +02:00
Javi Martín
6ad3bc063c Move budget stats translations to stats files
We were using custom translations, but now this code is going to be
included in the main CONSUL repository.
2019-05-21 13:50:17 +02:00
Javi Martín
cf32dcd6d5 Use the new stats layout in budget stats
So now stats by gender and age are replaced by shared participation
stats (which also includes stats by district), reusing the code already
used in poll stats, and advanced statistics (which used to be at the top
of the page) are now displayed after partipation stats.
2019-05-21 13:50:17 +02:00
Javi Martín
8f69113233 Add poll stats by geozone and channel 2019-05-21 13:50:17 +02:00
Javi Martín
202fb44008 Add poll stats by age and channel 2019-05-21 13:50:17 +02:00
Javi Martín
7b408a4b88 Add poll stats by gender and channel 2019-05-21 13:50:17 +02:00
Javi Martín
553af8e95b Add poll stats by channel
Note we currently don't have a way to get the votes by mail, so that
section is always blank.
2019-05-21 13:50:17 +02:00
Javi Martín
a9bb3eba26 Add headings for advanced statistics 2019-05-21 13:50:16 +02:00
Javi Martín
90fe746d27 Add geozone stats to polls 2019-05-21 13:50:16 +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
5a3eb70a46 Use same translations for poll and budget stats 2019-05-21 13:50:15 +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
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
Alberto
7db1cac3bc Merge pull request #3507 from consul/proposals-user-segment
Proposals authors user segment
2019-05-20 14:00:15 +02:00
decabeza
6cfb2e896d Change admin menu to menu 2019-05-17 17:47:46 +02:00
decabeza
f06cdc5fbb Change my activity menu to my content 2019-05-17 17:47:40 +02:00
decabeza
30cd7ec9b2 Add help text to admin newsletter new 2019-05-17 17:43:58 +02:00
decabeza
bec550e843 Fix typo on booth unassign spanish translation 2019-05-17 17:41:46 +02:00
decabeza
0c704c2f06 Replace i18n destroy to delete 2019-05-17 17:41:38 +02:00
decabeza
33c06ea0d3 Add help text to admin poll officers search 2019-05-17 17:41:36 +02:00
decabeza
8fda0bfb6c Add help text to slug on admin new site customization pages 2019-05-17 17:41:30 +02:00
Alberto
d845c6e973 Merge pull request #3476 from consul/delete-poll
Allow delete polls with associated questions and answers
2019-05-17 17:38:20 +02:00
decabeza
e6af2f15fb Add new user segment all_proposals_authors 2019-05-17 17:22:29 +02:00
Alberto
7c79965547 Merge pull request #3397 from consul/proposals-form
Remove question and external_url fields from proposals and legislation proposals
2019-05-17 17:08:56 +02:00
Angel Perez
a889f62f68 Remove unused budget I18n keys 2019-05-16 22:01:42 +02:00
María Checa
fac99cfb10 Add web and booth participants in budget stats 2019-05-16 22:01:42 +02:00
Bertocq
4691b486b0 Improve budget stats investments sent text to have a breakline on spanish 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
decabeza
75dfa4c663 fixes typo 2019-05-16 22:01:42 +02:00
decabeza
895c8292ab updates page title 2019-05-16 22:01:42 +02:00
decabeza
1c0c55c0fb improves texts and styles for budgets stats 2019-05-16 22:01:42 +02:00
Bertocq
fd4ea312c3 Fix budget stats translations with line breaks 2019-05-16 22:01:42 +02:00