Commit Graph

253 Commits

Author SHA1 Message Date
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
Juanjo Bazán
d7d277c64d removes unused code 2017-04-05 18:40:18 +02:00
Juanjo Bazán
3c2ab9fb05 adds validation for price when investment is feasible 2017-03-27 13:14:26 +02:00
rgarcia
4da66e3f51 Show should display supports 2017-03-24 13:49:56 +01:00
Juanjo Bazán
b8b7cda4e6 keeps Budget::Investment's group in sync with heading 2017-03-16 14:30:31 +01:00
rgarcia
537de8c46c Merge branch 'master' into budget-emails 2017-01-15 18:58:20 +01:00
rgarcia
68bf119c18 sends unfeasible budget investment 2017-01-14 17:02:33 +01:00
rgarcia
6d71cd985c displays appropriate vote info depending on phase 2017-01-13 21:15:08 +01:00
Raimond Garcia
4c818bfcc4 Merge pull request #1349 from consul/budgets-vote-permissions
User permissions for selecting phase
2017-01-13 18:34:31 +01:00