Commit Graph

9520 Commits

Author SHA1 Message Date
decabeza
9a60f5370d Moves h3 tag outside of table on polls results 2018-04-27 18:24:17 +02:00
decabeza
1f82599380 Adds class on back link to admin budget investments show 2018-04-27 18:24:17 +02:00
decabeza
dba8b6a7c9 Improves i18n of admin budgets 2018-04-27 18:24:17 +02:00
Alberto Calderón Queimadelos
0ec57409d1 Merge pull request #2598 from consul/avoid_dev_seeds_output_in_specs
Avoid db:dev_seed log print when run from its test
2018-04-25 21:40:20 +02:00
Alberto Calderón Queimadelos
f330aea108 Merge pull request #2613 from consul/fixup_investments_map
Fix MapLocation json_data to return mappable ids
2018-04-25 21:15:21 +02:00
Bertocq
a44c830cd4 Fix MapLocation json_data to return mappable ids
Until we correctly make MapLocation relation with mappables a polymorphic
one... we'll need to return the investment_id and proposal_id values.

Right now it was returning the MapLocation ID, and the JS was making a
call searching for an Investment with the MapLocation ID... sometimes
finding a record with same ID but totally NOT the one associated to the
MapLocation.
2018-04-25 20:05:19 +02:00
Alberto Calderón Queimadelos
26f72e437b Merge pull request #2599 from consul/remove_sitemap_generator_output
Remove sitemap generator output when running specs
2018-04-15 12:15:42 +02:00
Bertocq
23b15490ce Remove sitemap generator output when running specs
When running tests there is no need to pollute rspec's output with any
kind of log/info.
2018-04-14 22:26:03 +02:00
Bertocq
fcdc24a78c Avoid db:dev_seed log print when run from its test
The db:dev_seed rake logs info as it progresses as information for the
developer. But that's not needed when ran from its tests file, and it
bloats the travis/rspec output with unnecessary information.

Now the task will always log info unless the rake task receives an
optional argument.
2018-04-14 20:28:43 +02:00
Bertocq
a31b80fd76 Remove duplicated mailer entry 2018-04-13 07:40:09 +02:00
Alberto Calderón Queimadelos
5e7c522cc7 Merge pull request #2592 from consul/investment_valuator_groups_csv_table
Add valuator groups  assigned to investments to admin tables & csv export
2018-04-11 22:52:13 +02:00
Bertocq
33b6fa3a02 Refactor Investment csv download with filters test
There's no need to check again headers in this scenario, previous one
already does it.

Correctly naming variables, as well as using explicit expectations is a
good idea.

Last but not least, expectations where reversed but by luck or lack of
attention where passing.
2018-04-11 21:32:59 +02:00
Bertocq
71003875ae Refactor Investment CSV export download scenario
The created investment didn't had all data to correctly assert each
column values are correctly exported.

The expectations checking if each particular text appears are invalid in
this test. The objective is to check that the downloaded file contents
are exactly as they should be... not particular parts checked in an
independent way as for example "Yes" could appear in two different
columns and just looking if the text appears is not a valid assertion.
2018-04-11 21:32:57 +02:00
Bertocq
aacac71362 Extract Budget Investment to_csv to its own class
The csv generation doesn't seem like a Model concern, at least not taking
into account the amount of lines of the method (36+). Just a simple ruby
class that encapsulates the logic makes it easier to read and maintain as
we increase the columns exported.. also customize in case other forks need
different values.
2018-04-11 21:30:16 +02:00
Bertocq
83f4f4f65c Remove unnecesary parameter at Investment to_csv
If there's only one usage of `to_csv` and the parameter has always the
same value... there's no good reason to bother using an additional argument.
2018-04-11 21:14:13 +02:00
Bertocq
1dc8d29f2d Add Valuator Groups list to investment csv & table
We've added the list of valuator groups assigned to each investment at
 both admin investment list and investment csv exported file
2018-04-11 21:12:46 +02:00
Bertocq
b364fc475e Move assigned_valuators from helper to model
There's no good reason to call assigned_valuators(investment) when the
logic can be at the model.

Also removed the valuator_groups texts to be added in an independent
method
2018-04-11 21:07:01 +02:00
Alberto Calderón Queimadelos
494062300b Merge pull request #2585 from consul/document_upload_setting
Document upload setting
2018-04-10 13:59:32 +02:00
Bertocq
21ead40e26 Disable document upload & show with new setting
When Setting allow_attached_documents is disabled (false value) the user
should not be able to upload documents neither see the documents lists
2018-04-10 13:10:14 +02:00
Bertocq
e36c6c7781 Translate admin setting banner sections 2018-04-10 13:05:00 +02:00
Bertocq
35c156ba7a Create setting to enable/disable attached documents
Add setting to both seed and dev_seeds as well as a rake task to make it
easier to set.
2018-04-10 12:46:09 +02:00
Angel Perez
f9e8e2d86d I18n: cleanup for Admin English/Spanish strings
* Add missing exclamation marks
* Fix typos
* Remove duplicated keys
* Remove trailing whitespaces
* Replace single quotes with double quotes
* Replace untranslated strings
* Fix incorrect 'Spending proposal' assertion
2018-04-09 14:39:03 -04:00
Angel Perez
f36b58f605 I18n: cleanup for ActiveRecord English strings
* Remove duplicated strings
* Replace untranslated strings
2018-04-09 14:39:03 -04:00
iagirre
21a6d3495a Update PR with master
Rebase master branch so that this PR can
be updated with the latest changes.
Conflicts has been solved and some specs
updated to fit the new changes. dev_seeds
has been also adapted to the new format.
2018-04-09 16:11:06 +02:00
iagirre
d02b3e0486 Modifications to the spec to avoid using wait_for_ajax 2018-04-09 15:02:35 +02:00
iagirre
e2a91c6cc8 Modified the investments partial to fit the new budget_investments UI: valuating filter name has changed to under_valuation.
Modified the specs to fit the new UI for budget_investments
2018-04-09 15:02:35 +02:00
iagirre
b8cc10d218 Fix conflics after rebase 2018-04-09 15:02:35 +02:00
Alberto Calderón Queimadelos
01f421717d Merge pull request #2578 from consul/fix_valuation_heading_filters
Fix valuation heading filters
2018-04-06 12:02:27 +02:00
Bertocq
09fb4701b8 Fix Valuation Investment index heading filters
Why:

Heading filter where not being correctly displayed

How:

Increasing scenario to cover all possible combinations, and fixing the
heading_filters method of the Valuation Budget Investment Controller to
correctly:
  * Find how many investments the valuator can access
  * Count investments for each heading
2018-04-06 00:42:36 +02:00
Bertocq
0fceb1381f Fix line length at admin investment controller 2018-04-06 00:37:10 +02:00
Alberto Calderón Queimadelos
cbd06c2e1c Merge pull request #2576 from consul/refactor_for_valuator_groups
Add Valuator Group name validation & related specs
2018-04-06 00:22:58 +02:00
Bertocq
43d78c6c72 Adding Investment#by_valuator_group test scenario
Budget::Investment#by_valuator_group scope didn't had a test scenario
2018-04-06 00:22:41 +02:00
rgarcia
65e2360650 Use a float smaller than 1 as a random seed
By using a random seed value smaller than 1, we solve the previous
situation[1] in a simpler way

This test is now obsolete.
It’s hard to write a tests to verify that even with a big seed in
params, we will covert it to a float smaller than 1.

We should refactor these `set_random_seed` methods into a nice model or
controller concern and test it thoroughly

[1]
https://github.com/AyuntamientoMadrid/consul/commit/ba3bf11526fc6ce9c66f
647c414946c61ff945fe
2018-04-05 22:16:54 +02:00
rgarcia
3dcbb6b976 Run random order tests without javascript
Speeds it up a little, there is no need to take into account javascript
in these tests
2018-04-05 22:16:54 +02:00
rgarcia
ef30dc1efe Add defensive test to display correctly a user's votes
This is a defensive test, just in case we decide to go back to using
`setseed` instead of the `modulus`[1] approach to display investments
in random order

The reason for this test is that `setseed` only ~works in the next
`select` statement. And as when loading a user’s votes for investments
we do a second `select` it does not work as expected 😌

To solve this… we could call `set_random_seed` before loading a user’s
votes for an investment[2]

[1] https://github.com/consul/consul/pull/2131
[2]
https://github.com/AyuntamientoMadrid/consul/blob/master/app/controllers
/budgets/investments_controller.rb#L37
2018-04-05 22:16:54 +02:00
rgarcia
ce3cb045f8 Convert random seed to a small value
We are trying out a modulus function to return investments in random
order https://github.com/consul/consul/pull/2131

However we ran into the gotcha of having a seed value too big for the
modulus function to work as expected

If the seed is bigger than the investment id, the records are returned
ordered by id

By dividing the seed by a big number, this problem seems to get fixed
2018-04-05 22:16:54 +02:00
rgarcia
59805e9b73 Fix specs 2018-04-05 22:16:36 +02:00
Bertocq
48286f7de9 Validate ValuatorGroup#name presence & uniqueness
Why:

ValuatorGroup name should be unique and present to be able to identify
correctly each of them.

How:
  - Adding a presence & uniqueness validation at the model
  - Adding a sequenced value for name attribute at its factory
  - Adding missing model spec that covers validations
2018-04-05 22:12:06 +02:00
Raimond Garcia
1692abc54a Merge pull request #2374 from wairbut-m2c/upload_documents_feature
Upload documents feature
2018-04-05 19:39:12 +02:00
Raimond Garcia
5fae3c3c75 Merge pull request #2548 from wairbut-m2c/backport-let-manager-reset-users-password
Let managers reset user's password
2018-04-05 17:03:24 +02:00
Raimond Garcia
329a46888d Merge pull request #2575 from consul/no-budgets
Display message in budget's index when there are no budgets
2018-04-05 16:39:17 +02:00
decabeza
ef00eaa765 Adds missing content to budget investments mode view
This feature was already on Madrid fork and missing on backport
2018-04-05 14:53:22 +02:00
decabeza
b101b28d0f Adds view mode on proposals index 2018-04-05 14:52:56 +02:00
decabeza
563c1ebc93 Adds styles to no budgets message 2018-04-05 14:25:38 +02:00
rgarcia
39c6ac4a91 Display message in budget's index when there are no budgets
When there are no budgets we were seeing an exception in the budgets’
index

There are two parts to take into account here:
1) Making sure there is a current_budget present, otherwise we display
the “no budgets” message

2) The map helper is called from the controller, so we need to make
sure current_budget is present there too

Note: We could have added a bunch of `try` statements in the budgets’s
index, instead of using a conditional, however there are quite a few
`current_budget` calls so it seems more appropriate to use a conditional
2018-04-05 14:25:32 +02:00
Alberto Calderón Queimadelos
43390a632a Merge pull request #2574 from consul/rubocop_update
Update rubocop gem from 0.53.0 to 0.54.0
2018-04-05 09:20:43 +02:00
Raimond Garcia
65f5ab424b Merge pull request #2570 from consul/unfeasibility-explanation
Display unfeasibility explanation only when valuation has finished
2018-04-05 00:21:31 +02:00
Raimond Garcia
573885d0be Merge pull request #2569 from consul/change-email
Fix to change email address from my account
2018-04-05 00:21:20 +02:00
Raimond Garcia
787657e07e Merge pull request #2510 from consul/valuator-groups
Add valuator groups
2018-04-05 00:21:04 +02:00
Raimond Garcia
b9a1e19cbb Merge pull request #2568 from consul/gems
Update rails-html-sanitizer gem version to 1.0.4
2018-04-05 00:20:49 +02:00