From 29967d65b839a0f5a34815210d4e63bc7bdb6c45 Mon Sep 17 00:00:00 2001 From: akastijn Date: Fri, 24 Oct 2025 22:28:36 +0200 Subject: [PATCH] Improve vote eligibility check by adding `find` to handle cases where voteSite is not found. --- frontend/src/app/pages/vote/vote.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/pages/vote/vote.component.ts b/frontend/src/app/pages/vote/vote.component.ts index 608aa69..355eba2 100644 --- a/frontend/src/app/pages/vote/vote.component.ts +++ b/frontend/src/app/pages/vote/vote.component.ts @@ -94,9 +94,10 @@ export class VoteComponent implements OnInit, OnDestroy { return false; } const now: Date = new Date(); - return ( - this.voteStats.allVoteInfo.some(voteInfo => voteInfo.siteName === voteSite - && voteInfo.lastVoteTimestamp - now.getTime() > 86400000) - ) + const voteInfo = this.voteStats.allVoteInfo.find(voteInfo => voteInfo.siteName === voteSite); + if (!voteInfo) { + return true; + } + return (voteInfo.lastVoteTimestamp - now.getTime() > 86400000) } }