@@ -52,6 +52,10 @@ export class FlowService {
52
52
}
53
53
} ;
54
54
55
+ getOveralRanking = async ( cid = null ) => {
56
+ console . log ( cid ) ;
57
+ } ;
58
+
55
59
voteForCollections = async (
56
60
userId : number ,
57
61
collection1Id : number ,
@@ -226,6 +230,18 @@ export class FlowService {
226
230
227
231
const combinations = getPairwiseCombinations ( allIds ) ;
228
232
233
+ if ( allVotes . length === combinations . length )
234
+ return {
235
+ pairs : [ ] ,
236
+ totalPairs : combinations . length ,
237
+ votedPairs : allVotes . length ,
238
+ type : 'collection' as const ,
239
+ threshold : this . calculateThreshold (
240
+ allIds . length ,
241
+ parentCollection ? false : true ,
242
+ ) ,
243
+ } ;
244
+
229
245
const sortedCombinations = sortCombinations ( combinations , idRanking ) ;
230
246
231
247
const result = [ ] ;
@@ -276,7 +292,7 @@ export class FlowService {
276
292
277
293
return {
278
294
pairs,
279
- totalPairs : combinations . flat ( 0 ) . length ,
295
+ totalPairs : combinations . length ,
280
296
votedPairs : allVotes . length ,
281
297
type : 'collection' as const ,
282
298
threshold : this . calculateThreshold (
@@ -322,10 +338,20 @@ export class FlowService {
322
338
323
339
const combinations = getPairwiseCombinations ( allIds ) ;
324
340
341
+ if ( allVotes . length === combinations . length )
342
+ return {
343
+ pairs : [ ] ,
344
+ totalPairs : combinations . length ,
345
+ votedPairs : allVotes . length ,
346
+ type : 'project' as const ,
347
+ threshold : this . calculateThreshold ( allIds . length ) ,
348
+ } ;
349
+
325
350
const sortedCombinations = sortCombinations ( combinations , idRanking ) ;
326
351
327
352
const result = [ ] ;
328
353
let i = 0 ;
354
+
329
355
while ( result . length < count ) {
330
356
const combination = sortedCombinations [ i ] ;
331
357
const px = combination [ 0 ] ;
@@ -360,7 +386,7 @@ export class FlowService {
360
386
361
387
return {
362
388
pairs,
363
- totalPairs : combinations . flat ( 0 ) . length ,
389
+ totalPairs : combinations . length ,
364
390
votedPairs : allVotes . length ,
365
391
type : 'project' as const ,
366
392
threshold : this . calculateThreshold ( allIds . length ) ,
0 commit comments