diff --git a/receiptifyv1/app.js b/receiptifyv1/app.js index aa59f28..a4d7e77 100644 --- a/receiptifyv1/app.js +++ b/receiptifyv1/app.js @@ -258,13 +258,7 @@ async function processFile(filePath, sessionID, col) { }); const users = []; var newDB = ""; - var first = true; for await (const line of rl) { - if(first){ - newDB += line + "\n"; - first = false; - continue; - } const row = line.split(','); if (row[2] == sessionID) { users.push(row[col]); @@ -297,6 +291,9 @@ app.get('/callback', function (req, res) { if (req.cookies[sessionIDString] != null){ sessionID = req.cookies[sessionIDString]; } + + //res.sendFile(__dirname + '/public/join.html'); + var code = req.query.code || null; var state = req.query.state || null; diff --git a/receiptifyv1/public/server.js b/receiptifyv1/public/server.js index 4003409..34af43b 100644 --- a/receiptifyv1/public/server.js +++ b/receiptifyv1/public/server.js @@ -620,9 +620,18 @@ function getTopGenres(artists) { genreArr.sort(function (first, second) { return second.duration_ms - first.duration_ms; }); + let totalTime = 0; + for(let i = 0; i < 10; i++){ + console.log("helloe"); + totalTime += genreArr[i].duration_ms; + } + for(let i = 0; i < 10; i++){ + genreArr[i].duration_ms = genreArr[i].duration_ms * (100 / totalTime); + } return genreArr.slice(0, 10); } + const removeTrack = (i) => { console.log(i); if (i >= 0 && i < customReceipt.length) { @@ -1068,9 +1077,13 @@ function retrieveItems(stats, state) { const selectedType = type === 'genres' ? 'artists' : type; const timeRangeSlug = getPeriod(); const limit = num; + + let numPerPerson = []; + if ( type === 'artists' || type === 'genres') { + + - if ( type === 'artists') { const promises = []; let combined = []; if (users_checkbox[0].token == null || users_checkbox[0].user == null) { @@ -1121,7 +1134,7 @@ function retrieveItems(stats, state) { console.error('Errors:', errors); // Handle any errors }); } - + /* if (type === 'genres') { $.ajax({ url: `${SPOTIFY_ROOT}/me/top/artists?limit=49&time_range=${timeRangeSlug}`, @@ -1146,7 +1159,10 @@ function retrieveItems(stats, state) { } }, }); - } + + //console.log(item); + }*/ + //} //else { // shows tracks if (type === 'tracks'){ const promises = []; diff --git a/receiptifyv1/users.csv b/receiptifyv1/users.csv index f89444a..3abee9d 100644 --- a/receiptifyv1/users.csv +++ b/receiptifyv1/users.csv @@ -1,3 +1,5 @@ - -✧ jizzica ✧,BQBgPzh3R_Kro573KV7alDS0O74nCpx4WW8Xgj18Hp1AQE_ijZFkXsAneOIMF08SuHgfc2Ml_KrfykOjZ9Vxw_n8wc1wTwaqEGd358S21EXMo07-4WdlX3EPDyGqWoFQBcerzJ1hIyKBYb5HqH92WyaAi_laxxZSxkWaOTcgxVulWxVly-4XMvaI9VV3KuHt_JIZjbS8ontGZ3G35PDOLiFB6q5TawNbuTsBR48,261818,1713808836632, -✧ jizzica ✧,BQCrWoS_r3XRI3QaFaZ8lu-zR8W5RRxhLTlnNNJSVuYTyyc_LfZ1GfXqznB7iLb2sEhMr2TH28fcFW7R_pwas8147CwjxJcN5DYOdM41Pf2pazAlLUd1sls0trEuThcC9u8mJIb01RvAOFtVJFhHpB-DfCORDUVZykLrwwSs-V_yQ-9uDbo8vdjBlfLZnQo98BVvRvfc1yQOTMPbhqsbzSRW89tciuY-4LF6dW0,261818,1713808847899, + + +✧ jizzica ✧,BQBgPzh3R_Kro573KV7alDS0O74nCpx4WW8Xgj18Hp1AQE_ijZFkXsAneOIMF08SuHgfc2Ml_KrfykOjZ9Vxw_n8wc1wTwaqEGd358S21EXMo07-4WdlX3EPDyGqWoFQBcerzJ1hIyKBYb5HqH92WyaAi_laxxZSxkWaOTcgxVulWxVly-4XMvaI9VV3KuHt_JIZjbS8ontGZ3G35PDOLiFB6q5TawNbuTsBR48,261818,1713808836632, +✧ jizzica ✧,BQCrWoS_r3XRI3QaFaZ8lu-zR8W5RRxhLTlnNNJSVuYTyyc_LfZ1GfXqznB7iLb2sEhMr2TH28fcFW7R_pwas8147CwjxJcN5DYOdM41Pf2pazAlLUd1sls0trEuThcC9u8mJIb01RvAOFtVJFhHpB-DfCORDUVZykLrwwSs-V_yQ-9uDbo8vdjBlfLZnQo98BVvRvfc1yQOTMPbhqsbzSRW89tciuY-4LF6dW0,261818,1713808847899, +