Skip to content

Commit

Permalink
fix query
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-aurele-besner committed Dec 11, 2024
1 parent 24a4b5f commit 7804046
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions indexers/taskboard/src/utils/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const updateLeaderboardRanking = (sourceTable: string, targetTable: string) => `
SELECT id,
SUM(value) AS total_value,
MAX(last_contribution_at) AS last_contribution_at,
block_height AS created_at,
block_height AS updated_at
MIN(block_height) AS created_at,
MAX(block_height) AS updated_at
FROM leaderboard.${sourceTable}
GROUP BY id
),
Expand All @@ -72,7 +72,7 @@ const updateLeaderboardRanking = (sourceTable: string, targetTable: string) => `
INSERT INTO leaderboard.${targetTable} (id, rank, value, last_contribution_at, created_at, updated_at)
SELECT id, new_rank, total_value, last_contribution_at, created_at, updated_at FROM ranked_entries
ON CONFLICT (id)
DO UPDATE SET rank = EXCLUDED.rank, value = EXCLUDED.value, last_contribution_at = EXCLUDED.last_contribution_at, created_at = EXCLUDED.created_at, updated_at = EXCLUDED.updated_at;
DO UPDATE SET rank = EXCLUDED.rank, value = EXCLUDED.value, last_contribution_at = EXCLUDED.last_contribution_at, updated_at = EXCLUDED.updated_at;
`;

const consensusUpsertAccountQuery = `
Expand Down

0 comments on commit 7804046

Please sign in to comment.