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

[REF] Simplify getMembershipStatusByDate more #18051

Merged
merged 1 commit into from
Aug 4, 2020

Conversation

demeritcowboy
Copy link
Contributor

Overview

Follow-on from #18030

Before

Hard to understand function

After

A little better

Technical Details

  • Added/updated comments
  • Convoluted way of doing date('Ymd')
  • Required param in the middle of param list doesn't need to be required, and accepted null before anyway.
  • Move variables only used inside inner if into inner if to save valuable nanoseconds.
  • Add more test
  • There's some other tests in the file that don't clean up after themselves but need a stock setup to compare. Cleaned those up.

Comments

Could spend all day filling out the data provider. Also there's probably more in this function to simplify.

To see the test runs the same before and after you'd need to make the one change in the function declaration so the parameter isn't required, but otherwise it's the same result before and after.

@civibot
Copy link

civibot bot commented Aug 3, 2020

(Standard links)

@civibot civibot bot added the master label Aug 3, 2020
@eileenmcnaughton
Copy link
Contributor

@demeritcowboy thanks for doing this - it hurt to read but it hurts much less afterwards

@eileenmcnaughton eileenmcnaughton merged commit e7d2f52 into civicrm:master Aug 4, 2020
@demeritcowboy demeritcowboy deleted the member-status branch August 4, 2020 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants