From 74d75a0025dd5ccac38b7eafb9fb22ecac6fa4d6 Mon Sep 17 00:00:00 2001 From: wa0x6e <495709+wa0x6e@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:45:59 +0400 Subject: [PATCH 1/2] feat: return the vp_value property for votes and leaderboard --- src/graphql/schema.gql | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/graphql/schema.gql b/src/graphql/schema.gql index f0c5a502..eb37b242 100644 --- a/src/graphql/schema.gql +++ b/src/graphql/schema.gql @@ -225,12 +225,12 @@ input ProposalWhere { labels_in: [String] state: String space_verified: Boolean - flagged: Boolean, - votes: Int, - votes_gt: Int, - votes_gte: Int, - votes_lt: Int, - votes_lte: Int, + flagged: Boolean + votes: Int + votes_gt: Int + votes_gte: Int + votes_lt: Int + votes_lte: Int scores_total_value: Float scores_total_value_in: [Float] scores_total_value_gt: Float @@ -555,6 +555,7 @@ type Vote { vp: Float vp_by_strategy: [Float] vp_state: String + vp_value: Float } type Alias { @@ -667,6 +668,7 @@ type Leaderboard { proposalsCount: Int votesCount: Int lastVote: Int + vpValue: Float } type Option { From 0058f199c74797c5e5c002726cb415da21b74cc5 Mon Sep 17 00:00:00 2001 From: wa0x6e <495709+wa0x6e@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:46:20 +0400 Subject: [PATCH 2/2] feat: add vp_value to leaderboard sorting --- src/graphql/operations/leaderboards.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/graphql/operations/leaderboards.ts b/src/graphql/operations/leaderboards.ts index 6a263ee6..a9196ffb 100644 --- a/src/graphql/operations/leaderboards.ts +++ b/src/graphql/operations/leaderboards.ts @@ -9,7 +9,13 @@ export default async function (parent, args) { checkLimits(args, 'leaderboards'); - const ORDER_FIELDS = ['vote_count', 'proposal_count', 'last_vote', 'user']; + const ORDER_FIELDS = [ + 'vote_count', + 'proposal_count', + 'last_vote', + 'user', + 'vp_value' + ]; const DEFAULT_ORDER_FIELD = 'vote_count'; const fields = { @@ -37,7 +43,8 @@ export default async function (parent, args) { SELECT l.*, l.vote_count as votesCount, l.proposal_count as proposalsCount, - l.last_vote as lastVote + l.last_vote as lastVote, + l.vp_value as vpValue FROM leaderboard l WHERE 1=1 ${whereQuery.query} ORDER BY ${orderQuery} LIMIT ?, ?