Merge pull request #105 from vbaranov/ballot-vote-fix-2

(Fix) Ballot vote fix
This commit is contained in:
Victor Baranov 2018-03-21 09:26:10 +03:00 committed by GitHub
commit c53f1872ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 11 deletions

View File

@ -120,12 +120,13 @@ export class BallotCard extends React.Component {
let msFinish = finish.diff(_now);
if (msStart > 0) {
this.timeToStart.val = msStart;
this.timeToStart.val = msStart + 5000;
this.timeToStart.displayValue = this.formatMs(msStart, ":mm:ss");
return this.timeTo = this.timeToStart;
}
if (msFinish > 0) {
this.timeToStart.val = 0;
this.timeToFinish.val = msFinish;
this.timeToFinish.displayValue = this.formatMs(msFinish, ":mm:ss");
return this.timeTo = this.timeToFinish;
@ -225,26 +226,26 @@ export class BallotCard extends React.Component {
this.creator = fullName ? fullName : _miningKey;
}
isValidaVote = async () => {
isValidVote = async () => {
const { contractsStore, id, votingType } = this.props;
let isValidVote;
let _isValidVote;
try {
isValidVote = await this.getContract(contractsStore, votingType).isValidVote(id, contractsStore.votingKey);
_isValidVote = await this.getContract(contractsStore, votingType).isValidVote(id, contractsStore.votingKey);
} catch(e) {
console.log(e.message);
}
return isValidVote;
return _isValidVote;
}
isActive = async () => {
const { contractsStore, id, votingType } = this.props;
let isActive;
let _isActive;
try {
isActive = await this.getContract(contractsStore, votingType).isActive(id);
_isActive = await this.getContract(contractsStore, votingType).isActive(id);
} catch(e) {
console.log(e.message);
}
return isActive;
return _isActive;
}
getMemo = async () => {
@ -271,7 +272,7 @@ export class BallotCard extends React.Component {
return;
}
commonStore.showLoading();
let isValidVote = await this.isValidaVote();
let isValidVote = await this.isValidVote();
if (!isValidVote) {
commonStore.hideLoading();
swal("Warning!", messages.INVALID_VOTE_MSG, "warning");
@ -485,4 +486,4 @@ export class BallotCard extends React.Component {
</div>
);
}
}
}

View File

@ -196,7 +196,7 @@ export class NewBallot extends React.Component {
default:
break;
}
let curDateInSeconds = moment.utc().add(5, 'minute').unix();
let curDateInSeconds = moment.utc().add(5, 'minutes').unix();
methodToCreateBallot(curDateInSeconds)
.on("receipt", (tx) => {
commonStore.hideLoading();