Skip to content

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

Merged
merged 5 commits into from
Mar 29, 2023
Merged

Fix/plat 2567 #605

merged 5 commits into from
Mar 29, 2023

Conversation

ThomasKranitsas
Copy link
Contributor

No description provided.

Copy link
Contributor

@rakibansary rakibansary left a 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}`);
}
}

Copy link
Contributor

@rakibansary rakibansary Mar 29, 2023

Choose a reason for hiding this comment

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

image

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

Copy link
Contributor Author

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

Copy link
Contributor

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

@ThomasKranitsas ThomasKranitsas merged commit 0552fab into dev Mar 29, 2023
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.

2 participants