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

[Enterprise Fee Summary] Merge "Enterprise Fee Summary" report to master #3415

Merged
merged 65 commits into from
Feb 12, 2019

Conversation

kristinalim
Copy link
Member

@kristinalim kristinalim commented Jan 31, 2019

What? Why?

This would merge the transitional branch for the Enterprise Fee Summary to master.

What should we test?

  1. Do a general test of whether this breaks the layout and that checkout is not broken.
  2. Do a smoke test of report generation:
    a. Link in the admin Reports page
    b. Filters are working
    c. CSV report is working
    d. HTML report (below filters) is working

Release notes

  • Add "Enterprise Fee Summary" report available only to superadmin users.

Changelog Category: Added

Discourse thread

Dependencies

@kristinalim kristinalim self-assigned this Jan 31, 2019
@kristinalim
Copy link
Member Author

@kirstenalarsen Were you able to test #3115 with the recommendations I made in the issue description before? I was the one who merged that PR in the transitional branch, so I included an updated version of that (I added Items 2 and 5) here for a more thorough round of testing by a non-dev, before everything is merged to master.

@kristinalim
Copy link
Member Author

I moved this PR straight to "Test Ready" because these changes have already been approved in code review.

@kristinalim kristinalim changed the title [WIP] [Enterprise Fee Summary] Merge "Enterprise Fee Summary" report to master [Enterprise Fee Summary] Merge "Enterprise Fee Summary" report to master Jan 31, 2019
@kirstenalarsen kirstenalarsen added pr-staged-au staging.openfoodnetwork.org.au and removed pr-staged-au staging.openfoodnetwork.org.au labels Feb 1, 2019
@kirstenalarsen
Copy link
Contributor

@kristinalim I cannot stage this because the Semaphore build has failed . .

@kristinalim kristinalim added the pr-staged-au staging.openfoodnetwork.org.au label Feb 1, 2019
@kristinalim kristinalim removed the pr-staged-au staging.openfoodnetwork.org.au label Feb 1, 2019
Copy link
Member

@mkllnk mkllnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is too big to review thoroughly. But we reviewed all the individual parts. So it should be fine.

I'm really surprised by the huge amount of code for one report. Why do you think this report needs so much more code than others? Is it the nature of the complicated data structures?

@kristinalim
Copy link
Member Author

kristinalim commented Feb 1, 2019

@mkllnk I was surprised too, actually - I expected a lot of lines but not this much.

Although it makes sense:

  1. The code is split quite well into responsibilities (e.g. permissions, rendering, mapping DB result columns to report columns), for better readability and testability.
  2. We also have well formatted SQL left joins in Scope with lots of code whitespace. That class owns more than 10% of this PR in terms of added lines. (Preferred SQL left joins over eager/lazy -loading for better performance.) There is a pending issue [Enterprise Fee Summary] Explore refactoring the SQL in Scope wishlist#352 for seeing if ActiveRecord associations can be reused here.
  3. Great test coverage, IMO. 👍

Looking at the line count, almost half of added lines are for new test files:

$ wc -l $(find . -path "./spec/validators/*" -or -path "./engines/order_management/spec/*" -or -path ./spec/features/admin/reports/enterprise_fee_summaries_spec.rb -or -path spec/controllers/spree/admin/reports/enterprise_fee_summaries_controller_spec.rb)
[...]
   1491 total

Copy link
Contributor

@luisramos0 luisramos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the question would be: do you see how would you do this in multiple PRs that could go live individually? I think we need to learn to do that as a team.

Otherwise 👏 specially for your very high tests/code ratio

@kristinalim kristinalim added the pr-staged-au staging.openfoodnetwork.org.au label Feb 4, 2019
@kirstenalarsen
Copy link
Contributor

sooo. I am going to say that this is ok to merge to master as it is restricted to superadmin and it passes the tests above and doesn't break anything

I have found a few issues where I'm not sure what it's doing - BUT I think we are going to be so much better off to look at this with real data . . so let's get it through!
https://docs.google.com/document/d/1IxYHgzITDn0QcV-Po9sm1310cNiCdHTDx2kOGGlLrfY/edit

@kirstenalarsen kirstenalarsen removed the pr-staged-au staging.openfoodnetwork.org.au label Feb 8, 2019
@kirstenalarsen
Copy link
Contributor

Merge to master as passes tests above and is restricted to superadmin

There are some confusions, that I think need testing with real data
https://docs.google.com/document/d/1IxYHgzITDn0QcV-Po9sm1310cNiCdHTDx2kOGGlLrfY/edit

@sauloperez
Copy link
Contributor

./spec/features/admin/product_import_spec.rb:131 failed so I retried it. Meanwhile, I'll check if it is a flaky one. I'll merge as soon as it gets 🍏

@sauloperez
Copy link
Contributor

sauloperez commented Feb 8, 2019

Bad luck. spec/features/admin/product_import_spec.rb:131 is still failing (alongside other flaky ones this time) so might be related to this PR.

EDIT doesn't fail when executed multiple times on my machine

@luisramos0
Copy link
Contributor

maybe rebase to get latest "flaky fixes"?

@kristinalim
Copy link
Member Author

The product import spec failure is also an "intermittent" failure, which has been fixed here: #3430. "Intermittent" because it will pass in less than 24 hours, when it's February 10 in Melbourne time.

The other two are related to spec failures that still have open issues, but yes, better luck with a rebase.

I don't have Github permissions to modify this upstream branch though. Asking on Slack for anyone (any of you) to do this, or give me enough Github permissions. 🙂 Thanks!

The preferred language could change dynamically.
We should not presume what is not default for an enterprise fee object.
Make these follow the "#{SINGULAR_OBJECT}_factory.rb" convention.
Add test for more complex scenario where there is a coordinator and
distributor fee for an incoming exchange, and a producer and coordinator
fee for an outgoing exchange.
@luisramos0 luisramos0 force-pushed the feature/enterprise_fee_summary branch from 3200492 to b6be8c4 Compare February 8, 2019 21:27
@kristinalim
Copy link
Member Author

Yes! 😁 A green build. Thanks for rebasing, @luisramos0!

@kirstenalarsen
Copy link
Contributor

So this is ready to merge I think. Yay

@sauloperez
Copy link
Contributor

Putting the merge on hold until we get #3337 conflicts fixed.

@luisramos0
Copy link
Contributor

are we merging #3337 into this one and merging this one into master without staging/testing this and 3337 together?

@kristinalim
Copy link
Member Author

@luisramos0 That confused me too, because the base branch and separation of PRs is highly dependent on the timeline...

How about we merge this tested PR into master first. Then for #3337, I will change the PR base branch of #3337 to master and rebase it, and then it can also be merged without testing again? Considering that we often rebase PRs upon master even after testing.

@luisramos0
Copy link
Contributor

@kristinalim you will know what's the best approach :-)
I just wanted to raise the concern so that you aware.

@kristinalim
Copy link
Member Author

If that doesn't horrify the merger, that's the approach that I think is efficient and is still safe. 🙂 👍 I will update the other PR as soon as this is merged.

@sauloperez sauloperez merged commit a0c144f into master Feb 12, 2019
@mkllnk mkllnk deleted the feature/enterprise_fee_summary branch May 6, 2019 22:59
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.

Build Enterprise Fee Summary Report
5 participants