Commit Graph

1204 Commits

Author SHA1 Message Date
Javi Martín
0a578f2775 Create less records in budget stats specs
Creating only the necessary data for each test makes tests easier to
read. It also makes tests slightly faster.
2019-05-21 13:50:17 +02:00
Javi Martín
20b1085dc8 Simplify budget stats data generation
Configuring associations in the factories makes it easier to generate
headings, polls and ballots in the tests.
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
90fe746d27 Add geozone stats to polls 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
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
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
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
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
María Checa
fac99cfb10 Add web and booth participants in budget stats 2019-05-16 22:01:42 +02:00
Marko Lovic
70e108d593 Simplify spec 2019-05-16 22:01:42 +02:00
Marko Lovic
0c5f801c19 Keep DB clean after running budget stats spec
This spec was leaving the DB "dirty" because it was creating
records in a before(:all) hook. These records are not cleaned up
automatically when using the :transaction strategy for DatabaseCleaner.

Using before(:each), however, causes another problem. Some of the code
depends on the heading id being 1 (see app/models/budget/ballot/line.rb#L48).
Because of SQL auto-increment, this is only the case the first time the hook
is run, as different id's are assigned on subsequent runs. This is fixed
by forcing the id to always be 1.
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
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
decabeza
f40787561d Remove all references to question and external_url fields 2019-04-30 16:42:07 +02:00
decabeza
b023ceabdd Fixes not_to hound warnings 2019-04-30 12:00:54 +02:00
voodoorai2000
19b7526421 Add document upload from admin section 2019-04-30 11:59:08 +02:00
decabeza
0995480b73 Remove question and external_url fields from proposals 2019-04-30 11:35:47 +02:00
decabeza
20f505ab7c Fix specs 2019-04-29 15:44:41 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
Julian Herrero
83e129d5b7 Fix failing tests
If tests run very fast all votes are created within the last 24
hours, so hot_score has the same value if the creation date for the
votes is Time.current or 1.day.ago.

Creating the votes 48 hours ago we make sure hot_score has the
correct value and the tests pass correctly.
2019-04-17 17:40:56 +02:00
rgarcia
f23fd6f3bb Remove parameterise deprecation warning
DEPRECATION WARNING: Passing the separator argument as a positional
parameter is deprecated and will soon be removed. Use `separator: '_'`
instead.
2019-04-17 17:40:55 +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
María Checa
394177213c Adds Ballot Sheet model and business logic 2019-04-10 16:04:39 +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
decabeza
94b8caffca Merge branch 'master' into proposal-dashboard 2019-04-04 14:08:30 +02:00
lalo
237a03552f Move admin budget investments tabs filters to advanced filters component 2019-04-03 22:27:48 +02:00
rgarcia
7dd314c699 Do not display polls associated to a budget in admin poll questions
This section is used to select to which poll a question belongs to.

Budget polls are not meant to include questions that come from Citizen
Proposals or Government Questions, thus we do not display them
2019-04-03 22:20:01 +02:00
Javi Martín
f7f9fc15a5 Move todays_booths_for_officer to the model
This way we can easily add a test which will fail if by accident we
change the method to use `Date.today`. Until now using `Date.today`
would only fail if we ran specs in a time zone with a different date.
2019-03-28 15:49:17 +01:00
Bertocq
31428a5847 Add booth and officing assigments presence validation for booth votes, unskip specs 2019-03-28 15:47:52 +01:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Alberto
29a87e2746 Merge branch 'dashboard' into dashboard-polish 2019-03-26 12:19:20 +01:00
taitus
8b1c458fdf Allow detect new actions since a custom date
- Rename method "detect_new_actions" to "detect_new_actions_since". Add new param date.
2019-03-21 12:29:31 +01:00
taitus
08383b9cac Send new notification email after publish Proposal
After publish a proposal send email to proposal's author with information text and new actions available.
2019-03-21 12:29:30 +01:00
taitus
5177adb32a New rake task for proposals to send new action email
Execute rake task every day to detect new actions available for not archived proposals. If there are new actions available for today, send email to proposal's author with information text, new actions available and link to proposal dashboard url.
2019-03-21 12:29:28 +01:00
Javier Martín
0fd9570ea8 Merge pull request #3384 from consul/backport-simplify_poll_factories
Simplify poll factories
2019-03-20 14:32:47 +01:00
taitus
c959e078b8 Send new action notification email after create Proposal
After create a proposal send email to proposal's author with information text and new actions available.
2019-03-20 11:50:47 +01:00
taitus
868c37ef35 Detect new actions for proposals
Create new Dashboard::Action class method to detect new actions between yesterday and today for a proposal.
- Published proposal: Only detect new actions with "published_proposal" field eq true
- Draft proposal: Only detect new actions with "published_proposal" field eq false
2019-03-20 11:50:46 +01:00
decabeza
3f1d3f3443 Fix hound warnings 2019-03-19 18:24:49 +01:00
Julian Herrero
9ed6aae348 Refactor Setting model
- Make easier to group settings by using prefixes
- Add method to rename setting keys
- Add method to remove setting keys
2019-03-19 15:14:08 +01:00
Javi Martín
8118926ba7 Simplify tests creating poll voters 2019-03-19 13:29:43 +01:00
Javi Martín
4a3115607a Simplify poll stats test
Adding the option to assign a poll to a poll recount factory meant we
didn't need to create so much data.

Also note we're removing the `create(:poll_voter, origin: "booth")`
code, since it isn't used in the stats calculations.
2019-03-19 13:24:24 +01:00
rgarcia
8125d470de Add methods to obtain polls votable by a user 2019-03-06 17:42:46 +01:00
decabeza
4a532bf807 Use activerecord translations on admin legislation processes 2019-03-05 17:43:39 +01:00
Alberto
098f4b6c5f Merge pull request #3328 from consul/admin-settings
Improve Admin settings section
2019-02-27 10:49:54 +01:00