File tree Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Expand file tree Collapse file tree 3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,7 @@ export function formatProposal(proposal) {
440
440
proposal . plugins = jsonParse ( proposal . plugins , { } ) ;
441
441
proposal . scores = jsonParse ( proposal . scores , [ ] ) ;
442
442
proposal . scores_by_strategy = jsonParse ( proposal . scores_by_strategy , [ ] ) ;
443
+ proposal . vp_value_by_strategy = jsonParse ( proposal . vp_value_by_strategy , [ ] ) ;
443
444
let proposalState = 'pending' ;
444
445
const ts = parseInt ( ( Date . now ( ) / 1e3 ) . toFixed ( ) ) ;
445
446
if ( ts > proposal . start ) proposalState = 'active' ;
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ export default async function (parent, args) {
21
21
end : 'number' ,
22
22
type : 'string' ,
23
23
scores_state : 'string' ,
24
- votes : 'number'
24
+ votes : 'number' ,
25
+ scores_total_value : 'number'
25
26
} ;
26
27
const whereQuery = buildWhereQuery ( fields , 'p' , where ) ;
27
28
let queryStr = whereQuery . query ;
@@ -78,10 +79,13 @@ export default async function (parent, args) {
78
79
params . push ( JSON . stringify ( where . labels_in ) ) ;
79
80
}
80
81
82
+ const orderByFields = Object . entries ( fields )
83
+ . filter ( field => field [ 1 ] === 'number' )
84
+ . map ( field => field [ 0 ] ) ;
85
+
81
86
let orderBy = args . orderBy || 'created' ;
82
87
let orderDirection = args . orderDirection || 'desc' ;
83
- if ( ! [ 'created' , 'start' , 'end' , 'votes' ] . includes ( orderBy ) )
84
- orderBy = 'created' ;
88
+ if ( ! orderByFields . includes ( orderBy ) ) orderBy = 'created' ;
85
89
orderBy = `p.${ orderBy } ` ;
86
90
orderDirection = orderDirection . toUpperCase ( ) ;
87
91
if ( ! [ 'ASC' , 'DESC' ] . includes ( orderDirection ) ) orderDirection = 'DESC' ;
Original file line number Diff line number Diff line change @@ -231,6 +231,12 @@ input ProposalWhere {
231
231
votes_gte : Int ,
232
232
votes_lt : Int ,
233
233
votes_lte : Int ,
234
+ scores_total_value : Float
235
+ scores_total_value_in : [Float ]
236
+ scores_total_value_gt : Float
237
+ scores_total_value_gte : Float
238
+ scores_total_value_lt : Float
239
+ scores_total_value_lte : Float
234
240
}
235
241
236
242
input VoteWhere {
@@ -510,6 +516,8 @@ type Proposal {
510
516
scores_state : String
511
517
scores_total : Float
512
518
scores_updated : Int
519
+ scores_total_value : Float
520
+ vp_value_by_strategy : Any
513
521
votes : Int
514
522
flagged : Boolean
515
523
flagCode : Int
You can’t perform that action at this time.
0 commit comments