From f62b8586033e6c0fe74f070a3e000b498388c0c7 Mon Sep 17 00:00:00 2001 From: sophiacodes Date: Thu, 31 Oct 2024 13:47:01 +0000 Subject: [PATCH] cleanup debug and fix check voter address --- server/helpers/adapters/postgres.ts | 3 +-- server/index.ts | 10 ++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/server/helpers/adapters/postgres.ts b/server/helpers/adapters/postgres.ts index 1ad09f9e..db8e15c7 100644 --- a/server/helpers/adapters/postgres.ts +++ b/server/helpers/adapters/postgres.ts @@ -175,10 +175,9 @@ export const getVoteBySender = async ( address: string, proposalId: string ) => { - console.log('getVoteBySender', [space, address, proposalId]); const query = `SELECT * FROM messages WHERE space = $1 AND address = $2 AND payload ->> 'proposalId' = $3 AND type = 'vote'`; const result = await db.query(query, [space, address, proposalId]); - console.log('getVoteBySender result', result.rows.length); + console.log('check if voted result:', result.rows.length); return result.rows; }; diff --git a/server/index.ts b/server/index.ts index 7fc44972..4974d3de 100644 --- a/server/index.ts +++ b/server/index.ts @@ -467,21 +467,15 @@ router.post('/message', async (req, res) => { if (isNotInVotingWindow) return sendError(res, 'not in voting window'); - console.log('checking if already voted CURRENT', [ + console.log('checking if already voted:', [ space, body.address, msg.payload.proposalId ]); - console.log('checking if already voted NEW', [ - space, - msg.payload.metadata.memberAddress, - msg.payload.proposalId - ]); - const votes = await getVoteBySender( space, - body.address, + msg.payload.metadata.memberAddress, msg.payload.proposalId ); if (votes && votes.length > 0) return sendError(res, 'already voted');