Improve vote eligibility check by adding find to handle cases where voteSite is not found.
This commit is contained in:
parent
8b265514a6
commit
29967d65b8
|
|
@ -94,9 +94,10 @@ export class VoteComponent implements OnInit, OnDestroy {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const now: Date = new Date();
|
const now: Date = new Date();
|
||||||
return (
|
const voteInfo = this.voteStats.allVoteInfo.find(voteInfo => voteInfo.siteName === voteSite);
|
||||||
this.voteStats.allVoteInfo.some(voteInfo => voteInfo.siteName === voteSite
|
if (!voteInfo) {
|
||||||
&& voteInfo.lastVoteTimestamp - now.getTime() > 86400000)
|
return true;
|
||||||
)
|
}
|
||||||
|
return (voteInfo.lastVoteTimestamp - now.getTime() > 86400000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user