diff --git a/backend/.env b/backend/.env index 19703772..689f0626 100644 --- a/backend/.env +++ b/backend/.env @@ -1,2 +1,2 @@ -PEOPLE_DB=https://docs.google.com/spreadsheets/d/1s4Ytz7mf-YpszVTMTTrYd5iG_dsTGjrCpDQbpIx7zkU/edit#gid=1116948122 -PAIRS_LIST=https://docs.google.com/spreadsheets/d/1gPuRhTry3YoJ_ibI2BfL1ue2_YLlhtW56OP39ADJY_4/edit +PEOPLE_DB=https://docs.google.com/spreadsheets/d/1s4Ytz7mf-YpszVTMTTrYd5iG_dsTGjrCpDQbpIx7zkU/edit#gid=0 +PAIRS_LIST=https://docs.google.com/spreadsheets/d/1gPuRhTry3YoJ_ibI2BfL1ue2_YLlhtW56OP39ADJY_4/edit#gid=0 diff --git a/backend/app.js b/backend/app.js index 0c2979e8..93e545ad 100644 --- a/backend/app.js +++ b/backend/app.js @@ -386,6 +386,142 @@ function MakePairsV2(callback){ }); } +var matrix = []; +var tree = []; +let done = false; + +function count_pairs(row, col, cntr){ + if (done) return; + + matrix[row][col] = 2; + + //oznaci zauzeta polja zbog izbora para + for(let i=0;i{ + + let name1_id = names.indexOf(pair.name1); + let name2_id = names.indexOf(pair.name2); + + if (name1_id != -1 && name2_id != -1){ + if (name1_id > name2_id){ + matrix[name1_id][name2_id] = 3; + }else{ + matrix[name2_id][name1_id] = 3; + } + } + }); + + + + tree = []; + done=false; + + for (let i=0;i tree[max_count_index].length) + max_count_index = i; + } + + let result_pairs = []; + if (tree.length > 0){ + for (let i=0;i{ + if (a>b) return -1; else return 1; + }); + + for (let i=0;i{ pairsForSave=[]; lastRow=null; - MakePairsV2(resp); + MakePairsV3(resp); }); app.get('/getAllPairs',(req,resp)=>{ - MakePairsV2(resp); + MakePairsV3(resp); }); app.get('/savePairs', (req,resp)=>{