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

(Fix) manage crowdsale to allow edit if it didn't started yet #521

Merged
merged 2 commits into from
Jan 29, 2018

Conversation

fernandomg
Copy link
Contributor

Closes #519

@BlackDuckCoPilot
Copy link

Black Duck Security Report

Merging #521 into master will not change security risk.

Added Components

Clean: 182

Removed Components

Clean: 236

Click here to see full report

if (contract.startDate <= currentDate && currentDate <= contract.endDate) contract.current = true
const { startDate, endDate } = contract

if (index === 0 && currentDate < startDate || startDate <= currentDate && currentDate <= endDate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition is a little hard to read. At the very least we should use parentheses to make the precedence clear:

if ((index === 0 && currentDate < startDate) || (startDate <= currentDate && currentDate <= endDate))

Even better, extract the sub-conditions to variables:

const isActive = startDate <= currentDate && currentDate <= endDate
const isFirstTier = index === 0

if (isActive || (isFirstTier && currentDate < startDate)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated, thanks!

@vbaranov vbaranov merged commit 66d4338 into master Jan 29, 2018
@ghost ghost removed the awaiting for review label Jan 29, 2018
@fvictorio fvictorio deleted the edit-crowdsale-before-start branch February 16, 2018 17:26
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.

None yet

4 participants