-
Notifications
You must be signed in to change notification settings - Fork 52
Fix/plat 2567 #605
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
Fix/plat 2567 #605
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my review comment.
@@ -1589,6 +1589,18 @@ async function updateChallenge(currentUser, challengeId, data) { | |||
logger.debug(`There was an error trying to update the project: ${e.message}`); | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have the exact same check in another section. Let's avoid code duplication. Our last refactor extracted out common code to helper methods.
If the execution branch you introduced is different from the existing branch, the common code should move to a helper method with the different conditions at the top. For example
if (primaryConditionsAreSatisfied()) // chalengeStatuses in [ requirements infeasible, cancelled payment failed ]
if (conditionASatisfied() || conditionBSatisfied()) {
projectHelper.cancelProject()
}
This lets us immediately understand the conditions under which a project maybe cancelled. This commit introduces redundancy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! It introduces redundancy because I missed checking in the commit where I removed the duplicate code. Please check again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set the value of the variable isChallengeBeingCancelled
but we never use it. Since the section you are updating has to do with challenge cancellation, we should double check if there's any need for isChallengeBeingCancelled
and either add back functionality that we had before that we might have missed due to the refactor, or remove isChallengeBeingCancelled
No description provided.