Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup debug and fix check voter address #110

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions server/helpers/adapters/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
10 changes: 2 additions & 8 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading