Commit Graph

461 Commits

Author SHA1 Message Date
María Checa
87b13bab72 Add Budget::Investment::Statuses model 2018-06-27 16:44:48 +02:00
iagirre
8b9d1ebd33 Make portuguese locale work
There was a problem with the portuguese locale.
The locale was pt-BR, but `globalize_accessors` gem
doesn't allow the creation of methods using locales
with that format.

To avoid transforming pt-BR to pt and lose the distinction
of the different variations of the language, a function has
been added to transform pt-BR into pt_br (without changing
the locale itself). That way, when globalize uses the locales,
all of them will have a valid format (downcased and underscored)
AND they will be always the same (comparing pt-BR with pt_br
doesn't work).
2018-05-09 16:07:21 +02:00
rgarcia
f7486b9238 Add Globalize to Milestones 2018-05-09 16:05:44 +02:00
Alberto
1e8f4c7f32 Merge pull request #2342 from wairbut-m2c/iagirre-budgets-column-show-valuators
Budget: add column show to valuators
2018-04-30 17:49:15 +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
iagirre
b8cc10d218 Fix conflics after rebase 2018-04-09 15:02:35 +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
rgarcia
71bb5b3dcf Fix display of unfeasibility explanation
We were missing a check to make sure valuation had finished before
displaying the unfeasibility explanation
2018-04-04 14:38:31 +02:00
rgarcia
00c965b715 Clean up 2018-04-04 13:19:01 +02:00
rgarcia
7e839e7815 Filter by valuator group 2018-04-03 20:56:31 +02:00
rgarcia
ab498d6d93 Assign groups to investments 2018-04-03 20:55:44 +02:00
rgarcia
073cf74818 Fix edge case
The user was able to vote as many investments as wanted in the first
heading voted. However in the second heading voted, only one investment
could be voted

This was due to the previous implementation, where you could only vote
in one heading. Note the `first` call in method
`heading_voted_by_user?(user)`

This commits simplifies the logic and allows voting for any investment
in any heading that the user has previously voted in
2018-03-22 23:08:41 +01:00
rgarcia
5c6eaa76ff Add headings_voted_by_user
This method was used only in Madrid’s fork, but it is now needed to
complete the backport for voting in multiple headings

There wasn’t a test in Madrid, so here goes one too. Even though, the
responsibility should probably be moved soon to the `Budget::Heading`.
For consistency with the related methods and tests it has been left in
the investment_spec
2018-03-22 22:24:58 +01:00
rgarcia
0398bb23cb Consistent spacing
Temporarily… because there are 2 kinds of Ruby developers, those who
indent methods under `private` and does who don’t

https://gist.github.com/joefiorini/1049083#gistcomment-37692
2018-03-22 22:24:58 +01:00
rgarcia
bdffb9765e Allow voting in multiple headings
Now that we have the option of voting in multiple headings per group,
the method of voting in a “different heading assigned” has become
deprecated and thus removed
2018-03-22 22:24:58 +01:00
Raimond Garcia
c1d7378c92 Merge pull request #2504 from consul/budget_group_name_edit
Allow Budget Group names to be edited
2018-03-22 22:12:04 +01:00
rgarcia
7a980d79e7 Removes use of slugs to edit group name
Changing a group’s `to_param` to return the slug instead of the id,
breaks many tests in the user facing interface

We should use slugs in upstream soon, but it should be done in a
separate PR, bringing the whole slug implementation from Madrid’s fork
and the corresponding test coverage
2018-03-22 20:06:53 +01:00
decabeza
0e9190bc43 Adds heading link on different heading message 2018-03-08 11:50:09 +01:00
Raúl Fuentes
6d8d44a5e3 Added interface and methods for edit the name of a Budget::Group if the budget is still inthe drafting phase 2018-03-02 09:16:57 +01:00
Bertocq
6d9926441e Reverse investment scoped filter for budget by slug and then id 2018-02-10 16:39:27 +01:00
Bertocq
2341a2f70b Add by_budget scope to Investment and use it 2018-02-10 16:36:14 +01:00
Bertocq
7e67e8c93b Remove unnecesary empty line at milestone model 2018-02-05 15:54:33 +01:00
BertoCQ
c16e42e1e3 Merge pull request #2434 from consul/slug_generation_logic
Only change budget slugs if its on draft phase
2018-02-05 15:35:58 +01:00
Bertocq
e0871e5dc6 Only update slug if empty or model condition is met 2018-02-04 23:04:48 +01:00
Bertocq
a297faec4b Add order scope to milestone for publication date 2018-02-03 19:15:31 +01:00
Angel Perez
47c9b343ee Admins can search investments by title or ID (#2401) 2018-01-31 09:52:55 -04:00
Raimond Garcia
45d07fa16f Merge pull request #2407 from wairbut-m2c/aperez-investment-filters-aggregation
Investments can be applied several filters at once
2018-01-31 14:39:02 +01:00
BertoCQ
ec81f399bf Merge pull request #2403 from consul/valuation_comments
Valuation comments
2018-01-31 13:46:22 +01:00
Angel Perez
a5159672d4 Investments are now aggregated when using more than 1 advanced filter 2018-01-31 07:21:51 -04:00
BertoCQ
f0f41b0403 Merge pull request #2373 from consul/single_heading_group_names
Improve heading names at select boxes
2018-01-31 02:35:11 +01:00
Bertocq
4ec30a9082 Avoid using comments_count counter_cache at Investment
As Budget::Investment has two relationships over commentable polymorphic
relationship, the counter_cache is counting the sum of both comments and
valuations.

We don't show valuations count anywhere, only the (public) comments so
we just use comments.count in this case
2018-01-31 02:05:37 +01:00
Bertocq
767fd04bdf Add valuation comments relation at Budget Investment
Why:

Budget Investments already has an existing `comments` relation that is
on use. We need to keep that relation unaltered after adding the
internal valuation comments, that means scoping the relation to only
public comments (non valuation ones) so existing code using it will
remain working as expected.

A new second relation will be needed to explicitly ask for valuation
comments only where needed, again scoping to valuation comments.

How:

Adding a second `valuations` relationship and filtering on both
with the new `valuation` flag from Comment model.
2018-01-30 19:22:27 +01:00
Angel Perez
e04dc5b8f2 Add sorting options for Admin::BudgetInvestments (#2336) 2018-01-25 08:18:04 -04:00
Bertocq
ce3bf20152 Add group name on heading options if more than one heading per group 2018-01-24 12:15:56 +01:00
Bertocq
9bb088a5c7 Add single_heading_group? helper at Budget::Group model 2018-01-24 12:15:43 +01:00
María Checa
1c2949b60d Merge pull request #2344 from wairbut-m2c/aperez-investments-filters
Improvements for Admin::Budget::Investment filters
2018-01-23 20:09:54 +01:00
Raúl Fuentes
82b750de68 moved duplicated code to helper 2018-01-23 15:42:01 +01:00
iagirre
846898f3ec New phase "Information" added and UI modified to not show the links.
Specs to test the functionality added.
2018-01-23 15:42:01 +01:00
Bertocq
d017b5bb49 Make Budget::Phase#invalid_dates_range? private 2018-01-23 00:23:22 +01:00
Bertocq
16b6abe2b8 Touch Budget object after updating a Budget::Pphase
Why:

We need to clear associated rails cache keys in order for changes to be
ready to be seen on the views

How:

* Just an after_save callback to a private method
2018-01-23 00:23:19 +01:00
Angel Perez
ff40d32028 Add new filters to Admin::Budget::Investment navbar 2018-01-22 14:02:29 -04:00
Angel Perez
e5c73d8f02 Add advanced filters for Admin::Budget::Investment 2018-01-22 14:02:29 -04:00
María Checa
1f461b09f0 Merge pull request #2353 from consul/2339-admin_budgets_phases
Allow admins to edit Budget phases
2018-01-22 18:07:34 +01:00
Raúl Fuentes
93268fc5d6 changed advanced filter from budgets to budgets/investments 2018-01-22 09:59:09 +01:00
María Checa
1abb7f0310 Added admin budget phases controller and routes 2018-01-19 17:55:24 +01:00
decabeza
f722caac24 removes budget steps on header 2018-01-19 14:35:05 +01:00
Bertocq
7599eb4c35 Refactor budget phases step progress functions and usage 2018-01-18 17:18:05 +01:00