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

Remove unreachable code & variable cleanup in membership back office form template #19647

Merged
merged 4 commits into from
Feb 22, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Feb 22, 2021

Overview

Removes some unreachable code and cleans up some variables

Before

  • The 'else' part of the if (term) {} else {} is unreachable
    -References to membershipType are allMemberships[memType] which is confusing

After

else bit gone
Values assigned to array membershipType. membershipTypeID consistently used for the variable meaning membership type id - was memType AND membershipType - both retrieved from the same jquery

Technical Details

Term is always set at this point unless we are dealing with a priceset - in which case the early return would have been hit - ergo term is always set

We also know that this code is unreachable as in the 6 years it has been in the
codebase no-one has reported the bug in it. It uses total_amount not total_amount_numerci
in the first part of the calculation - this would fail when the decimal separator
is not a decimal

Comments

existingAmount is never used except in this if so cannot be true. feeTotal
is used above this point but not below it - so this code is extraneous
Term is always set at this point unless we are dealing with a priceset - which
this handling appears to be for, ergo term is always set.

We also know that this code is unreachable as in the 6 years it has been in the
codebase no-one has reported the bug in it. It uses total_amount not total_amount_numerci
in the first part of the calculation - this would fail when the decimal separator
is not a decimal
@civibot
Copy link

civibot bot commented Feb 22, 2021

(Standard links)

@eileenmcnaughton eileenmcnaughton changed the title Remove unreachable code Remove unreachable code & variable cleanup in membership back office form template Feb 22, 2021
@colemanw
Copy link
Member

Looks good.

@eileenmcnaughton
Copy link
Contributor Author

Thanks - I'll wait until it's passed / merged & then close the others (in case there is some issue with the test run)

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