Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add valuator groups assigned to investments to admin tables & csv export #2592

Merged
merged 6 commits into from
Apr 11, 2018

Conversation

bertocq
Copy link
Collaborator

@bertocq bertocq commented Apr 11, 2018

References

This is a backport & refactor from madrid's fork AyuntamientoMadrid#1287 & AyuntamientoMadrid#1422

Objectives

Valuator Groups are now assigned to Investments, and need to be displayed in both:

  • Admin Investments list
  • Investments export to csv from admins investment list

Visual Changes (if any)

Yes, check referenced PR's

Notes

Maybe too much refactor on a single PR... but we're trying to cleanup pending backports to be able to merge latest changes around this CSV export.

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
We've added the list of valuator groups assigned to each investment at
 both admin investment list and investment csv exported file
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.
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.
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.
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.
@bertocq bertocq merged commit 5e7c522 into master Apr 11, 2018
@bertocq bertocq deleted the investment_valuator_groups_csv_table branch April 11, 2018 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants