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

View File

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