File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -234,12 +234,22 @@ pub async fn units_for_slot_get_campaigns(
234
234
vec ! [ Box :: new( active_to_ge) , Box :: new( creator) ] ;
235
235
236
236
// Deposit assets
237
- match deposit_assets {
237
+ match deposit_assets. cloned ( ) {
238
238
Some ( assets) if !assets. is_empty ( ) => {
239
- let assets_vec = assets. iter ( ) . copied ( ) . collect :: < Vec < _ > > ( ) ;
239
+ // we start from $3 parameter
240
+ let start_index = params. len ( ) + 1 ;
240
241
241
- where_clauses. push ( "channels.token IN ($3)" . into ( ) ) ;
242
- params. push ( Box :: new ( assets_vec) )
242
+ let in_clause = assets. into_iter ( ) . enumerate ( ) . fold (
243
+ vec ! [ ] ,
244
+ |mut in_clause, ( asset_index, asset) | {
245
+ in_clause. push ( format ! ( "${}" , start_index + asset_index) ) ;
246
+ params. push ( Box :: new ( asset) ) ;
247
+
248
+ in_clause
249
+ } ,
250
+ ) ;
251
+
252
+ where_clauses. push ( format ! ( "channels.token IN ({})" , in_clause. join( "," ) ) ) ;
243
253
}
244
254
_ => { }
245
255
} ;
You can’t perform that action at this time.
0 commit comments