Commit Graph

461 Commits

Author SHA1 Message Date
iagirre
f7e96067b0 Actions for budgets' headings added. Edit headings, delete headings if not budget investments associated and add link in order to see budgets investments filtered by the heading.
Cambios para hacer commit:
	modificado:    app/controllers/admin/budget_headings_controller.rb
	modificado:    app/models/budget/heading.rb
	nuevo archivo: app/views/admin/budget_headings/_errors.html.erb
	nuevo archivo: app/views/admin/budget_headings/edit.js.erb
	nuevo archivo: app/views/admin/budget_headings/update.js.erb
	modificado:    app/views/admin/budgets/_group.html.erb
	nuevo archivo: app/views/admin/budgets/_heading.html.erb
	nuevo archivo: app/views/admin/budgets/_heading_form.html.erb
	modificado:    config/locales/en/activerecord.yml
	modificado:    config/locales/es/activerecord.yml
	modificado:    spec/features/admin/budgets_spec.rb
	modificado:    spec/models/budget/heading_spec.rb
2017-09-25 15:40:17 +02:00
taitus
74958b461a Add new model concern Communitable with relation, callback and associate community. 2017-09-05 12:54:32 +02:00
taitus
895c942a39 Add community to investments 2017-09-05 12:52:45 +02:00
Senén Rodero Rodríguez
4081dded5f Add nested documents to new budgetinvestments. 2017-08-25 18:34:53 +02:00
Senén Rodero Rodríguez
38d4d59241 Add arguments to documentable concern to make it configurable for any recipient model. 2017-08-25 17:27:37 +02:00
Senén Rodero Rodríguez
6b61cbe35c Set maximum number of documents on proposal and budget investments. Show alert on documents tab when maximum reached. Hide upload button when maximum reached. 2017-08-25 17:27:37 +02:00
Senén Rodero Rodríguez
a2130689ed Create documentable concern and add it to budget investment model. Create documents controller, documents helper, routes, translations and specs 2017-08-25 17:27:37 +02:00
BertoCQ
204ea13c85 Merge branch 'master' into followable 2017-07-11 11:30:49 +02:00
Bertocq
efacd0def3 Make calculate_winners explicitly delayed
Why:

* As seen on preproduction and production environments on Madrid's fork. Budget::Result#calculate_winners is very costly when done to all headings for a given budget (as requested on Admin::BudgetsController#calculate_winners) but its not when done individually for only a heading (as requested on Budget::Investment#recalculate_heading_winners)

How:

* Removing `handle_asynchronously :calculate_winners` from bellow Budget::Result#calculate_winners definition, to avoid making any call delayed. And explicitly calling `.delay` only when needed (on Admin::BudgetsController#calculate_winners)
2017-07-10 15:12:14 +02:00
Bertocq
2b85deabec Recalculate heading winners on incompatibility change
Why:

* We should recalculate winners also when an incompatible investment is flagged as compatible again

How:

* Removing the condition to recalculate that was checking only for a winner investment flagged as incompatible
* Extending the Budget::Result model spec to cover that new scenario
2017-07-10 14:24:55 +02:00
Bertocq
69f4e1c683 Fix all rubocop Metrics/LineLength issues (140+) 2017-07-10 13:22:49 +02:00
taitus
bce28afe36 Add followable to budget investment model. 2017-07-07 12:07:25 +02:00
BertoCQ
e990568895 Merge pull request #1721 from consul/feature/add_slugs_to_budget_related
Add slugs to budget related
2017-07-05 13:16:24 +02:00
Bertocq
e3d89261a6 Add Sluggable concern and unique validation to Budget, Group and Heading
* What: We need to generate slug on Budget, Group and Heading classes, validating its unique for its scope

* How: Adding a presence and unique validation using Budget always as scope.
2017-07-05 12:33:16 +02:00
Bertocq
2888c20489 Fix all Style/RedundantSelf rubocop issues 2017-07-05 11:55:52 +02:00
Bertocq
339597483e Add incompatible scope to Budget Investment model 2017-07-04 01:34:25 +02:00
Bertocq
99052485fb Recalculate heading winner investments when a winner is flagged as incompatible 2017-07-04 01:34:24 +02:00
Bertocq
640e0e1c2a Use compatible filter when calculating budget heading winners 2017-07-04 01:34:24 +02:00
Bertocq
ed016d7afd Add compatible scope to Budget Investment and use it on the winners scope
Why:

* Only compatible investments can be winners

How:

* Using the new column incompatible to filter compatible investments
2017-07-04 01:34:24 +02:00
Bertocq
c9bc028524 Remove all unnecesary extra spacing and Layout/ExtraSpacing list from rubocop file 2017-06-28 14:12:51 +02:00
Bertocq
f6fe9cc7d2 Fix all Layout/SpaceAroundOperators rubocop issues and remove file list from rubocop_todo list 2017-06-26 18:04:20 +02:00
Raimond Garcia
6e60f5acde Merge pull request #1680 from consul/chore/small_rubocop_cleanup
Chore/small rubocop cleanup
2017-06-26 17:42:10 +02:00
Raimond Garcia
f41d3637cf Merge pull request #1678 from consul/feature/1601#budget_winner_investments_button
Add button to Calculate Budget Winner investments
2017-06-26 17:41:08 +02:00
Bertocq
154cdac332 Add calculate_winners on Admin Budget controller, route and ability for admins 2017-06-25 15:47:04 +02:00
Bertocq
8d84ed712a Fix all Rails/Validation rubocop issues and remove files from rubocop_todo list 2017-06-25 15:46:46 +02:00
taitus
f220952883 Add CRUD Milestone on Admin::BudgetInvestment. Rename Checkpoint to Milestone. 2017-06-24 22:38:48 +02:00
taitus
beeb5412d7 New Checkpoint model. Update factories. Model specs. 2017-06-24 22:38:48 +02:00
Bertocq
1a20c1c785 Add winners scope to Budget Investments 2017-06-21 01:32:22 +02:00
Bertocq
02524b164a Rubocop autocorrections (indentations, revers unless to if, extra spaces) 2017-06-08 12:14:35 +02:00
decabeza
0e581896c0 improves message when not enough money 2017-05-26 17:12:21 +02:00
rgarcia
ed5a1cecbb adds budget results 2017-05-19 14:04:46 +02:00
Juanjo Bazán
f0d7acd087 Merge pull request #1550 from consul/budgets-unfeasible
Investments reclassified as unfeasible
2017-05-18 14:37:32 +02:00
rgarcia
a63ca9649e cleans up 2017-05-17 20:32:05 +02:00
Alberto
8167203e6e Merge pull request #1546 from consul/no-money-error
Fix no money error
2017-05-17 17:36:20 +02:00
rgarcia
47f97e342d extracts reclassification to a module 2017-05-17 15:18:39 +02:00
Juanjo Bazán
d08af6193e changes unselected scope to include undecided feasibility 2017-05-17 15:13:29 +02:00
rgarcia
42f62e5c36 stores reclassified votes 2017-05-17 15:13:28 +02:00
Juanjo Bazán
3eb22ab7b9 removes exception on invalid vote
responds rendering correct error message instead
2017-05-16 13:12:32 +02:00
rgarcia
9a75067d73 Do not display voting button for unselected investments 2017-05-14 18:15:04 +02:00
rgarcia
62b2f4812b fixes false positive when storing previous heading id 2017-05-14 11:38:05 +02:00
rgarcia
1ca16d9d40 removes votes from reclassified investments 2017-05-13 13:10:04 +02:00
rgarcia
c0488c3b3c refactors investment filters 2017-05-06 04:57:06 +02:00
Alberto Garcia Cabeza
5727969eac adds specs for unselected budget investments 2017-05-05 20:01:32 +02:00
Alberto Garcia Cabeza
6ab6986d9e adds unselected investment link 2017-05-05 19:07:37 +02:00
Alberto Garcia Cabeza
98a76a1ae5 show price on index/show if feasible && selected 2017-05-05 17:14:54 +02:00
rgarcia
8083f259c2 takes into account headings without balloted investments 2017-05-03 17:49:29 +02:00
rgarcia
2f6c1bc7bc displays the correct amount spent in review my ballot
returns the first heading with investments for a group
2017-05-03 17:06:27 +02:00
Juanjo Bazán
a4bfe9c50c adds ballot_lines counter to investments 2017-04-28 13:19:43 +02:00
Raimond Garcia
441dee84c4 Merge pull request #1493 from consul/cleanup
removes unused code
2017-04-17 19:16:06 +02:00
Juanjo Bazán
61e5c187da shows investment price info only if phase is balloting or later 2017-04-17 13:15:17 +02:00