From 2cff74aa54aad5e1d35cf73fd2a9676235beb20a Mon Sep 17 00:00:00 2001 From: Jacob Levine Date: Thu, 21 Mar 2019 23:12:49 -0500 Subject: [PATCH] website for peoria --- .../__pycache__/analysis.cpython-36.pyc | Bin 25273 -> 25273 bytes .../__pycache__/tbarequest.cpython-36.pyc | Bin 0 -> 2771 bytes .../__pycache__/visualization.cpython-36.pyc | Bin 0 -> 3911 bytes website/public/profile/index.html | 4 +- website/public/scout/{rpts => }/index.html | 10 +- website/public/scout/rpts/scripts.js | 272 ---------- website/public/scout/scripts.js | 466 ++++++++++++++++++ website/public/scout/signUps/index.html | 53 -- website/public/scout/signUps/scripts.js | 214 -------- website/public/stats/index.html | 14 +- website/public/team/index.html | 8 +- 11 files changed, 486 insertions(+), 555 deletions(-) create mode 100644 data analysis/__pycache__/tbarequest.cpython-36.pyc create mode 100644 data analysis/__pycache__/visualization.cpython-36.pyc rename website/public/scout/{rpts => }/index.html (79%) delete mode 100644 website/public/scout/rpts/scripts.js create mode 100644 website/public/scout/scripts.js delete mode 100644 website/public/scout/signUps/index.html delete mode 100644 website/public/scout/signUps/scripts.js diff --git a/data analysis/__pycache__/analysis.cpython-36.pyc b/data analysis/__pycache__/analysis.cpython-36.pyc index bb37e54948766e3d358b9a78e77e89b1e0060f2a..a886300d7bd1713f9b614768f486335099b29db2 100644 GIT binary patch delta 4168 zcma)9du&tJ8PDrCO9yV ze*S#!IluFr-|zd5Z_d5T&b`Z$YtzzF)|wUv-~MiLb2^j59qGq)dDeu41YS;1K~PCh zgw;X~>kS^m(=GB5J;8yt96yHi4)e~$Z z*iNtmT&7>|aA0Uj$^*e*D_PFeY23=fu)*=?XC;by)m zr-qi+5!eYHBoLgt!EDV6e=G9>D=DMFI9jR6V=ni^gnKL)un;lrUjwgZyF21c=ATCv z5|+p|6Vwve2(}=oiBT$EL_-3KDWc?VfiuGdo}AfE!7Nf;=36X%9DUWKnP{%d`R!oK zy)KjRd?&(v)fXE@42>uiXE**3(Z$&EAU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1q8!<7rbe+;+YHdIFm%pGLh zs0+F4renx%gST*r7nD8w7t+O#g!BUgIOo2tLjMb_#B{QA9b!O%$A&o!(^guV{sbZ+ zO-MP%hWw*WhP1y2JiQ>>!>fcW&yekefNhUGjtH<0NvORM0 z_<$r#tt7Mw$N7R%aX{c#aGYMr@(_?K$Jt(b*y`xbL!1_5V1n7l5=;@_^&^%>y1|9~K z4Wk9Um~tbT0h~n_afMMT=qb-Tg#sMH1;^6`&zs!OfX#cJ4|jz~0-XgK?mgb9U}0%Z zE0DyrEitjBM_Xdlr?Db&TUWL^*{`-Y+7a)y#3mLzh1H2=nZcMr$B$u|HnXkCW82n0 DfOmsL literal 0 HcmV?d00001 diff --git a/data analysis/__pycache__/visualization.cpython-36.pyc b/data analysis/__pycache__/visualization.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f3fde124556194c157509f8a2ce63816a723df9 GIT binary patch literal 3911 zcmcgv&2JmW72nw}eu$(#ZA-C}uyzoXfvZZgVmXE##j%?rv7@?C0|Q$X#BgUxEwfy* zvqM`Fs9uyFee12q_R=1E?6H49FFh2PYYvG}pnpIw?(fagl&r)}4{3KXZ{Ez#&b~MA z{eClhty(S5o%_wsZ)Ys)3+vQXhW;K(_E!jD1(sj|6Lw$=N4UZhz9@*ID2cL|5|vIl za70zq61VFGzR?On5%qLZ>Xn0XZz`DTRe}n$&^MD*d$piu^x0&(HxtbCW`o(@Trk(0 z59ZN7C*04iU_s1_GU{_;K@?D*7w1F?^#yTW6j3jV3!;L0Ni2#b)USxk;*xMaXTe2r zMZ6|FXqUw6!pE~$MO{pxeofT2t;QP%rPbvXx>r^Y9)-I+?LQYjn#g0Ao~MdYH``@ zNIuxrzG!73PqqJ9FXCyYO9|#^l7+fB2zist(9P4yI)NU|c+g5O#OR*jDB$5qR&)*r_`Vgk_ z4p&$W?caNU`|h1B?ce{{m^rsS{^Z@s3Whd)6&KYG%3YM~DulASY-Am=!(3y~n6kUh z$QrRDn_1A^BMaGLA);)n;b}V^=mO8Ulzd-1gG6ZuOQzjyxBsMJYqqD^{vRxP5tILG z^X|=^PqRp7J7(c`?)AeVd6?}exwf*lmhA|xc%7#_+0Wu^2TL^MNqk@&TORC7viJLB zYZ1a?W!x3^9eN`dFs(dC;yi>djDsf^(Q4RoiJrVdg8a$FCDO>AAENx943n?YN59P| z4}-3M%_xdDT|Nq#ZDN0uy(IQl*B)72=g5LYStfyuN+V4xEw_{psfWQm;NnhrK@gx>%w{y*0|Jdxb&GpaCp^KrP z{N+!#k15BGDRkNofeirN4(50JGCt@N7XS~Plt2^AK8_@a?Nrx+`|i5t|2#9MSDtnvOi2ko^$>Q z5VQlr(=NnbKyqKR_$)XIu;(^PR)@$@`zCXN-OC2Qb8LkzK+9!F*3(4`LhEPp^9?8p z`6leA#7OMOCcvM+wgqbgA(NI(E#g?it?+}ANxlgIWpld=ooMUa0*aX0P)%5N2hee0FRO?A2Ct60OxXmA9~6G zj6G59pa-o=w~8ah^ix0|dTr#4ou4tzKW|m2C1yw7h@qY{;IDM2CjeV`9#**y!w(8q zu5D~Yts79KTH6$I90NNQGtVljeLtE~+B~LK z=+J0flslAACU^3K0w92I;b=I4CGX>$C-!9P&mUKxuDb;R=HH1~|Uy@<2xI zNJeQGHGG4}e9>?iwzLCmYFi0iz$g)i3PbMUf&7rfM-T{n0BH;)+n9wU=|a} z`y?Jf=t9Cb zzUa;z*)(xS{*;=ZkT9pDQ+|MJhrP)h-{KIZ(G!&aokMaP)4vdyd9wPy@kIWNMjBMT zG$JJo`4!3w4jlja*|TTh#1fFJ2m~OG@H8GY)*cC&@4Bbe5kOy zLoYy25-77hu4v~?;ua3QW)JrBI_C%vtBu1jMIktseU?OArpqFt|Brqa(@#LoM@06r z2B9aT04n^}g!JQ-c1-35)6ZuZ=YS*}N|VYa0nFObhGq`Al8_^5N6+^pVnst7l8`4U zTO~zU(kh)IBeP4× Profile Team -

Scout Matches

- Sign Up For Matches - Submit Scouting Reports + Scout Matches Tournament Stats
diff --git a/website/public/scout/rpts/index.html b/website/public/scout/index.html similarity index 79% rename from website/public/scout/rpts/index.html rename to website/public/scout/index.html index d8659c54..e42bd203 100644 --- a/website/public/scout/rpts/index.html +++ b/website/public/scout/index.html @@ -34,8 +34,14 @@ Scouting For:

Submit a Report:

- - Team Scouted: +
+ Match: + Team: + Series: +
diff --git a/website/public/scout/rpts/scripts.js b/website/public/scout/rpts/scripts.js deleted file mode 100644 index 44111926..00000000 --- a/website/public/scout/rpts/scripts.js +++ /dev/null @@ -1,272 +0,0 @@ -/* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */ -function openNav() { - document.getElementById("mySidenav").style.width = "250px"; - document.getElementById("main").style.marginLeft = "250px"; - document.body.style.backgroundColor = "rgba(0,0,0,0.4)"; -} - -/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */ -function closeNav() { - document.getElementById("mySidenav").style.width = "0"; - document.getElementById("main").style.marginLeft = "0"; - document.body.style.backgroundColor = "white"; -} - -window.onload = function() { - document.getElementById('sideload').style.display = 'block'; - var config = { - apiKey: "(insert the TitanScout Api Key Here)", - authDomain: "titanscoutandroid.firebaseapp.com", - databaseURL: "https://titanscoutandroid.firebaseio.com", - projectId: "titanscoutandroid", - storageBucket: "titanscoutandroid.appspot.com", - messagingSenderId: "1097635313476" - }; - //eventually find a less-jank way to do this tho - firebase.initializeApp(config); - firebase.auth().onAuthStateChanged(function(user) { - if (user != null) { - if (user.displayName != null) { - document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName; - } else if (user.email != null) { - document.getElementById('status').innerHTML = "You are signed in as: " + user.email; - } else if (user.phoneNumber != null) { - document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber; - } else { - document.getElementById('status').innerHTML = "You are signed in."; - } - } else { - window.location.replace('../../'); - } - teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid); - teamAssoc.get().then(function(doc) { - if (doc.exists) { - list = doc.data() - teamNums = Object.keys(list) - document.getElementById('tns').innerHTML = "" - for (var i = 0; i < teamNums.length; i++) { - document.getElementById('tns').innerHTML += "" - } - } else {} - }).then(function() { - changeTeam(document.getElementById('tns').value) - }) - }); -} - -function changeTeam(teamNum) { - //remove all event listeners for element by cloning it - var old_element = document.getElementById("mSelect"); - var new_element = old_element.cloneNode(true); - old_element.parentNode.replaceChild(new_element, old_element); - //ok back to normal stuff - var user = firebase.auth().currentUser; - ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); - currentComp = null; - ti.get().then(function(doc) { - if (doc.exists) { - info = doc.data(); - currentComp = info['currentCompetition']; - } else { - alert("Something's wrong with firebase."); - throw ("Something's wrong with firebase."); - } - }).then(function() { - if (currentComp != null) { - comps = firebase.firestore().collection('matchSignupsIndividual').doc(user.uid).collection("team-" + teamNum).doc(currentComp); - comps.get().then(function(doc) { - if (doc.exists) { - var matches = doc.data(); - document.getElementById('mSelect').innerHTML = ""; - for (var i = 0; i < Object.keys(matches).length; i++) { - name = Object.keys(matches)[i]; - series = matches[Object.keys(matches)[i]]['series']; - completed = matches[Object.keys(matches)[i]]['completed']; - if (!completed) { - document.getElementById('mSelect').innerHTML += "" - } - } - document.getElementById('mSelect').addEventListener("change", function() { - updateForm(document.getElementById('mSelect').value, teamNum, currentComp); - }); - updateForm(document.getElementById('mSelect').value, teamNum, currentComp); - } - }); - } - }); -} - -function lastWord(words) { - var n = words.split(" "); - return n[n.length - 1]; -} - -function firstWord(words) { - var n = words.split(" "); - return n[0]; -} - -function updateForm(locString, teamNum, competition) { - seriesList = []; - document.getElementById('FormData').innerHTML = "" - loc = firebase.firestore().collection('appBuliding').doc("team-" + teamNum).collection('competitions').doc(competition).collection(lastWord(locString)); - loc.get().then(function(docs) { - docs.forEach(function(doc) { - seriesList.push(doc.data()); - }); - seriesList.sort(function(a, b) { - return a.order - b.order; - }) - for (var i = 0; i < seriesList.length; i++) { - document.getElementById('FormData').innerHTML += "

" - seriesList[i].id + "

"; - labels = Object.keys(seriesList[i].data()); - var index = labels.indexOf('order'); - if (index > -1) { - labels.splice(index, 1); - } - var questions = []; - for (var j = 0; j < labels.length; j++) { - questions.push([labels[j], seriesList[i].data()[labels[j]]]) - } - questions.sort(function(a, b) { - return a[1].order - b[1].order; - }) - for (var j = 0; j < questions.length; j++) { - document.getElementById('FormData').innerHTML += "
"; - document.getElementById('FormData').innerHTML += questions[j][1]['title']; - if (questions[j][1]['type'] = 'shortText') { - document.getElementById('FormData').innerHTML += ""; - } else if (questions[j][1]['type'] = 'longText') { - document.getElementById('FormData').innerHTML += ""; - } else if (questions[j][1]['type'] = 'numerical') { - document.getElementById('FormData').innerHTML += "" + (questions[j][1]['default']).toString() + ""; - } else if (questions[j][1]['type'] = 'range') { - document.getElementById('FormData').innerHTML += "  " + questions[j][1]['min']['text'] + "  "; - document.getElementById('FormData').innerHTML += ""; - document.getElementById('FormData').innerHTML += "  " + questions[j][1]['max']['text']; - } else if (questions[j][1]['type'] = 'segment') { - document.getElementById('FormData').innerHTML += "
" - for (var k = 0; k < questions[j][1]['elements'].length; k++) { - //// TODO: replace with real buttons for good styling - document.getElementById('FormData').innerHTML += questions[j][1]['elements'][k]; - document.getElementById('FormData').innerHTML += "" - } - document.getElementById('FormData').innerHTML += "
" - } - document.getElementById('FormData').innerHTML += "
"; - } - } - document.getElementById('FormData').innerHTML += "" - }); -} - -function dec(id) { - document.getElementById(id).innerHTML = (parseInt(document.getElementById(id).innerHTML) - 1).toString() -} - -function inc(id) { - document.getElementById(id).innerHTML = (parseInt(document.getElementById(id).innerHTML) + 1).toString() -} - -function subReport(team, comp, matchNum) { - var push = {} - var x = document.getElementById('FormData').children; - for (var i = 0; i < x.length; i++) { - if (x[i].children[0].tagName == "INPUT") { - push[x[i].children[0].id] = x[i].children[0].tagName; - } else if (x[i].children[0].tagName == "TEXTAREA") { - push[x[i].children[0].id] = x[i].children[0].innerHTML; - } else if (x[i].children[0].tagName == "SPAN") { - push[x[i].children[0].id] = x[i].children[0].innerText; - }else if (x[i].children[0].tagName == "DIV") { - var name=x[i].children[0].id; - push[name]=document.querySelector('input[name="'+name+'"]:checked').value; - } - } - var user = firebase.auth().currentUser; - firebase.firestore().collection("teamData").doc('team-' + team).collection('scouts').doc(user.uid).collection(comp).doc("team-" + scoutedTeamNumber + matchNum).set(push, { - merge: true - }).then(function () { - firebase.firestore().collection("data").doc('team-' + team).collection(comp).doc("team-" + scoutedTeamNumber).collection('matches').doc('match-' + matchNum).set(push, { - merge: true - }); - }); -} - -/* - -function subRes() { - firebase.firestore().collection('teamData').doc('team-' + document.getElementById('tns').value).get().then(function(doc) { - if (doc.exists) { - comp = doc.data()['currentCompetition']; - } - }).then(function() { - - - var user = firebase.auth().currentUser; - push = {} - push['match'] = 'match-' + document.getElementById('mn').value - push['teamDBRef'] = 'team-' + document.getElementById('tsn').value - push['speed'] = document.getElementById('speed').value - push['sandstormCross'] = document.getElementById('SCross').value - push['strategy'] = document.getElementById('strat').value - push['contrubution'] = document.getElementById('contrib').value - push['startingHatch'] = document.getElementById('habs').value - push['size'] = document.getElementById('egs').value - - push['fillChoice'] = document.getElementById('SFill').value - push['functional'] = document.getElementById('DOA').value - push['strongMedium'] = document.getElementById('SSO').value - push['sandstormCrossBonus'] = document.getElementById('SCross').value - - push['fillChoiceTeleop'] = document.getElementById('TFill').value - push['strongMediumTeleop'] = document.getElementById('TSO').value - - push['cargoSuccessTeleop'] = document.getElementById('CSSR').value - push['hiRocketSuccessTeleop'] = document.getElementById('HRSR').value - push['lowRocketSuccessTeleop'] = document.getElementById('LRSR').value - - push['endingHab'] = document.getElementById('HAB').value - - firebase.firestore().collection("teamData").doc('team-' + document.getElementById('tns').value).collection('scouts').doc(user.uid).collection(comp).doc("team-" + document.getElementById('tsn').value + "-match-" + document.getElementById('mn').value).set(push, { - merge: true - }) - }).then(function() { - var user = firebase.auth().currentUser; - push = {} - push['match'] = 'match-' + document.getElementById('mn').value - push['teamDBRef'] = 'team-' + document.getElementById('tsn').value - push['speed'] = document.getElementById('speed').value - push['sandstormCross'] = document.getElementById('SCross').value - push['strategy'] = document.getElementById('strat').value - push['contrubution'] = document.getElementById('contrib').value - push['startingHatch'] = document.getElementById('habs').value - push['size'] = document.getElementById('egs').value - - push['fillChoice'] = document.getElementById('SFill').value - push['functional'] = document.getElementById('DOA').value - push['strongMedium'] = document.getElementById('SSO').value - push['sandstormCrossBonus'] = document.getElementById('SCross').value - - push['fillChoiceTeleop'] = document.getElementById('TFill').value - push['strongMediumTeleop'] = document.getElementById('TSO').value - - push['cargoSuccessTeleop'] = document.getElementById('CSSR').value - push['hiRocketSuccessTeleop'] = document.getElementById('HRSR').value - push['lowRocketSuccessTeleop'] = document.getElementById('LRSR').value - - push['endingHab'] = document.getElementById('HAB').value - firebase.firestore().collection("data").doc('team-' + document.getElementById('tns').value).collection(comp).doc("team-" + document.getElementById('tsn').value).collection('matches').doc('match-' + document.getElementById('mn').value).set(push, { - merge: true - }) - } - - ).then(function() { - alert('Submitted!') - setTimeout(function() { - window.location.href = '../scout'; - }, 500); - - }) -}*/ diff --git a/website/public/scout/scripts.js b/website/public/scout/scripts.js new file mode 100644 index 00000000..803495d5 --- /dev/null +++ b/website/public/scout/scripts.js @@ -0,0 +1,466 @@ +/* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */ +function openNav() { + document.getElementById("mySidenav").style.width = "250px"; + document.getElementById("main").style.marginLeft = "250px"; + document.body.style.backgroundColor = "rgba(0,0,0,0.4)"; +} + +/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */ +function closeNav() { + document.getElementById("mySidenav").style.width = "0"; + document.getElementById("main").style.marginLeft = "0"; + document.body.style.backgroundColor = "white"; +} + +window.onload = function() { + document.getElementById('sideload').style.display = 'block'; + var config = { + apiKey: "(insert the TitanScout Api Key Here)", + authDomain: "titanscoutandroid.firebaseapp.com", + databaseURL: "https://titanscoutandroid.firebaseio.com", + projectId: "titanscoutandroid", + storageBucket: "titanscoutandroid.appspot.com", + messagingSenderId: "1097635313476" + }; + //eventually find a less-jank way to do this tho + firebase.initializeApp(config); + firebase.auth().onAuthStateChanged(function(user) { + if (user != null) { + if (user.displayName != null) { + document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName; + } else if (user.email != null) { + document.getElementById('status').innerHTML = "You are signed in as: " + user.email; + } else if (user.phoneNumber != null) { + document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber; + } else { + document.getElementById('status').innerHTML = "You are signed in."; + } + } else { + window.location.replace('../../'); + } + teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid); + teamAssoc.get().then(function(doc) { + if (doc.exists) { + list = doc.data() + teamNums = Object.keys(list) + document.getElementById('tns').innerHTML = "" + for (var i = 0; i < teamNums.length; i++) { + document.getElementById('tns').innerHTML += "" + } + } else {} + }).then(function() { + changeTeam(document.getElementById('tns').value) + }) + }); +} + +function changeTeam(teamNum) { + document.getElementById('mSelect').innerHTML = "" + var user = firebase.auth().currentUser; + ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); + currentComp = null; + ti.get().then(function(doc) { + if (doc.exists) { + info = doc.data(); + currentComp = info['currentCompetition']; + } else { + alert("Something's wrong with firebase."); + throw ("Something's wrong with firebase."); + } + }).then(function() { + if (currentComp != null) { + matches = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('scoutsAndSchedule'); + matches.get().then(function(qs) { + qs.forEach(function(dc) { + //regex search! + var pattern = /\d+/; + var name = dc.id; + document.getElementById('mSelect').innerHTML += ""; + }); + cmatch(document.getElementById('mselect').value); + }); + } + }); +} + +function cmatch(matchName) { + document.getElementById('tselect').innerHTML = "" + var user = firebase.auth().currentUser; + ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); + currentComp = null; + ti.get().then(function(doc) { + if (doc.exists) { + info = doc.data(); + currentComp = info['currentCompetition']; + } else { + alert("Something's wrong with firebase."); + throw ("Something's wrong with firebase."); + } + }).then(function() { + if (currentComp != null) { + match = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('scoutsAndSchedule').doc('match-' + matchName) + match.get().then(function(doc) { + if (doc.exists) { + data = doc.data() + for (var i = 0; i < Object.keys(data['BLUE']).length; i++) { + var pattern = /\d+/; + document.getElementById('tselect').innerHTML += ""; + } + for (var i = 0; i < Object.keys(data['RED']).length; i++) { + var pattern = /\d+/; + document.getElementById('tselect').innerHTML += ""; + } + cseries(document.getElementById('sselect').value); + } + }) + } + }); +} + +function cseries(seriesName) { + document.getElementById('mSelect').innerHTML = "" + var user = firebase.auth().currentUser; + ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); + currentComp = null; + ti.get().then(function(doc) { + if (doc.exists) { + info = doc.data(); + currentComp = info['currentCompetition']; + } else { + alert("Something's wrong with firebase."); + throw ("Something's wrong with firebase."); + } + }).then(function() { + if (currentComp != null) { + + if (seriesName == "quantitative") { + document.getElementById('FormData').innerHTML += "

" + 'Sandstorm' + "

"; + document.getElementById('FormData').innerHTML += "
"; + var ss = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appBuliding').doc('quantitativeSandstorm'); + ss.get().then(function(doc) { + if (doc.exists) { + processAndAppendReturn(doc.data()) + } + document.getElementById('FormData').innerHTML += "
"; + }).then(function() { + document.getElementById('FormData').innerHTML += "

" + 'TeleOp' + "

"; + document.getElementById('FormData').innerHTML += "
"; + var to = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appBuliding').doc('quantitativeTeleop'); + to.get().then(function(doc) { + if (doc.exists) { + processAndAppendReturn(doc.data()) + } + document.getElementById('FormData').innerHTML += "
"; + }).then(function() { + document.getElementById('FormData').innerHTML += "

" + 'Cycle Times' + "

"; + document.getElementById('FormData').innerHTML += "
"; + var cyc = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appBuliding').doc('quantitativeCycleTimes'); + cyc.get().then(function(doc) { + if (doc.exists) { + processAndAppendReturn(doc.data()) + } + document.getElementById('FormData').innerHTML += "
"; + }); + }); + }); + } else if (seriesName = "qualitative") { + document.getElementById('FormData').innerHTML += "

" + 'Sandstorm' + "

"; + document.getElementById('FormData').innerHTML += "
"; + var ss = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appBuliding').doc('qualitativeSandstorm'); + ss.get().then(function(doc) { + if (doc.exists) { + processAndAppendReturn(doc.data()) + } + document.getElementById('FormData').innerHTML += "
"; + }).then(function() { + document.getElementById('FormData').innerHTML += "

" + 'TeleOp' + "

"; + document.getElementById('FormData').innerHTML += "
"; + var to = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appBuliding').doc('qualitativeTeleop'); + to.get().then(function(doc) { + if (doc.exists) { + processAndAppendReturn(doc.data()) + } + document.getElementById('FormData').innerHTML += "
"; + }).then(function() { + document.getElementById('FormData').innerHTML += "

" + 'Strategy' + "

"; + document.getElementById('FormData').innerHTML += "
"; + var strat = firebase.firestore().collection('appBuliding').doc('team-' + teamNum).collection('competitions').doc(currentComp).collection('appBuliding').doc('qualitativeStrategy'); + strat.get().then(function(doc) { + if (doc.exists) { + processAndAppendReturn(doc.data()) + } + document.getElementById('FormData').innerHTML += "
"; + }); + }); + }); + } + document.getElementById('FormData').innerHTML += ""; + } + }); +} + +function processAndAppendReturn(data) { + labels = Object.keys(data); + var questions = []; + for (var j = 0; j < labels.length; j++) { + questions.push([labels[j], data[labels[j]]]); + } + questions.sort(function(a, b) { + return a[1].order - b[1].order; + }) + for (var j = 0; j < questions.length; j++) { + document.getElementById('FormData').innerHTML += "
"; + document.getElementById('FormData').innerHTML += questions[j][1]['title']; + if (questions[j][1]['type'] = 'shortText') { + document.getElementById('FormData').innerHTML += ""; + } else if (questions[j][1]['type'] = 'longText') { + document.getElementById('FormData').innerHTML += ""; + } else if (questions[j][1]['type'] = 'numerical') { + document.getElementById('FormData').innerHTML += "" + (questions[j][1]['default']).toString() + ""; + } else if (questions[j][1]['type'] = 'range') { + document.getElementById('FormData').innerHTML += "  " + questions[j][1]['min']['text'] + "  "; + document.getElementById('FormData').innerHTML += ""; + document.getElementById('FormData').innerHTML += "  " + questions[j][1]['max']['text']; + } else if (questions[j][1]['type'] = 'segment') { + document.getElementById('FormData').innerHTML += "
" + for (var k = 0; k < questions[j][1]['elements'].length; k++) { + //// TODO: replace with real buttons for good styling + document.getElementById('FormData').innerHTML += questions[j][1]['elements'][k]; + document.getElementById('FormData').innerHTML += "" + } + document.getElementById('FormData').innerHTML += "
" + } + document.getElementById('FormData').innerHTML += "
"; + } + +} + +/* +function updateForm(locString, teamNum, competition) { + seriesList = []; + document.getElementById('FormData').innerHTML = "" + loc = firebase.firestore().collection('appBuliding').doc("team-" + teamNum).collection('competitions').doc(competition).collection(lastWord(locString)); + loc.get().then(function(docs) { + docs.forEach(function(doc) { + seriesList.push(doc.data()); + }); + seriesList.sort(function(a, b) { + return a.order - b.order; + }) + for (var i = 0; i < seriesList.length; i++) { + document.getElementById('FormData').innerHTML += "

" + seriesList[i].id + "

"; + labels = Object.keys(seriesList[i].data()); + var index = labels.indexOf('order'); + if (index > -1) { + labels.splice(index, 1); + } + var questions = []; + for (var j = 0; j < labels.length; j++) { + questions.push([labels[j], seriesList[i].data()[labels[j]]]) + } + questions.sort(function(a, b) { + return a[1].order - b[1].order; + }) + for (var j = 0; j < questions.length; j++) { + document.getElementById('FormData').innerHTML += "
"; + document.getElementById('FormData').innerHTML += questions[j][1]['title']; + if (questions[j][1]['type'] = 'shortText') { + document.getElementById('FormData').innerHTML += ""; + } else if (questions[j][1]['type'] = 'longText') { + document.getElementById('FormData').innerHTML += ""; + } else if (questions[j][1]['type'] = 'numerical') { + document.getElementById('FormData').innerHTML += "" + (questions[j][1]['default']).toString() + ""; + } else if (questions[j][1]['type'] = 'range') { + document.getElementById('FormData').innerHTML += "  " + questions[j][1]['min']['text'] + "  "; + document.getElementById('FormData').innerHTML += ""; + document.getElementById('FormData').innerHTML += "  " + questions[j][1]['max']['text']; + } else if (questions[j][1]['type'] = 'segment') { + document.getElementById('FormData').innerHTML += "
" + for (var k = 0; k < questions[j][1]['elements'].length; k++) { + //// TODO: replace with real buttons for good styling + document.getElementById('FormData').innerHTML += questions[j][1]['elements'][k]; + document.getElementById('FormData').innerHTML += "" + } + document.getElementById('FormData').innerHTML += "
" + } + document.getElementById('FormData').innerHTML += "
"; + } + } + document.getElementById('FormData').innerHTML += "" + }); +} +*/ +function dec(id) { + document.getElementById(id).innerHTML = (parseInt(document.getElementById(id).innerHTML) - 1).toString() +} + +function inc(id) { + document.getElementById(id).innerHTML = (parseInt(document.getElementById(id).innerHTML) + 1).toString() +} + +function subReport() { + document.getElementById('mSelect').innerHTML = "" + var user = firebase.auth().currentUser; + ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); + currentComp = null; + ti.get().then(function(doc) { + if (doc.exists) { + info = doc.data(); + currentComp = info['currentCompetition']; + } else { + alert("Something's wrong with firebase."); + throw ("Something's wrong with firebase."); + } + }).then(function() { + if (currentComp != null) { + var submitTo = document.getElementById('tns').value; + var teamNum = document.getElementById('tselect').value; + var matchNum = document.getElementById('mselect').value; + var series = document.getElementById('sselect').value; + var push = {} + var x = document.getElementById('repsec1').children; + for (var i = 0; i < x.length; i++) { + if (x[i].children[0].tagName == "INPUT") { + push[x[i].children[0].id] = x[i].children[0].tagName; + } else if (x[i].children[0].tagName == "TEXTAREA") { + push[x[i].children[0].id] = x[i].children[0].innerHTML; + } else if (x[i].children[0].tagName == "SPAN") { + push[x[i].children[0].id] = x[i].children[0].innerText; + } else if (x[i].children[0].tagName == "DIV") { + var name = x[i].children[0].id; + push[name] = document.querySelector('input[name="' + name + '"]:checked').value; + } + } + var x = document.getElementById('repsec2').children; + for (var i = 0; i < x.length; i++) { + if (x[i].children[0].tagName == "INPUT") { + push[x[i].children[0].id] = x[i].children[0].tagName; + } else if (x[i].children[0].tagName == "TEXTAREA") { + push[x[i].children[0].id] = x[i].children[0].innerHTML; + } else if (x[i].children[0].tagName == "SPAN") { + push[x[i].children[0].id] = x[i].children[0].innerText; + } else if (x[i].children[0].tagName == "DIV") { + var name = x[i].children[0].id; + push[name] = document.querySelector('input[name="' + name + '"]:checked').value; + } + } + var x = document.getElementById('repsec3').children; + for (var i = 0; i < x.length; i++) { + if (x[i].children[0].tagName == "INPUT") { + push[x[i].children[0].id] = x[i].children[0].tagName; + } else if (x[i].children[0].tagName == "TEXTAREA") { + push[x[i].children[0].id] = x[i].children[0].innerHTML; + } else if (x[i].children[0].tagName == "SPAN") { + push[x[i].children[0].id] = x[i].children[0].innerText; + } else if (x[i].children[0].tagName == "DIV") { + var name = x[i].children[0].id; + push[name] = document.querySelector('input[name="' + name + '"]:checked').value; + } + } + } + }); +} + +/* +function subReport(team, comp, matchNum) { + var push = {} + var x = document.getElementById('FormData').children; + for (var i = 0; i < x.length; i++) { + if (x[i].children[0].tagName == "INPUT") { + push[x[i].children[0].id] = x[i].children[0].tagName; + } else if (x[i].children[0].tagName == "TEXTAREA") { + push[x[i].children[0].id] = x[i].children[0].innerHTML; + } else if (x[i].children[0].tagName == "SPAN") { + push[x[i].children[0].id] = x[i].children[0].innerText; + } else if (x[i].children[0].tagName == "DIV") { + var name = x[i].children[0].id; + push[name] = document.querySelector('input[name="' + name + '"]:checked').value; + } + } + var user = firebase.auth().currentUser; + firebase.firestore().collection("teamData").doc('team-' + team).collection('scouts').doc(user.uid).collection(comp).doc("team-" + scoutedTeamNumber + matchNum).set(push, { + merge: true + }).then(function() { + firebase.firestore().collection("data").doc('team-' + team).collection(comp).doc("team-" + scoutedTeamNumber).collection('matches').doc('match-' + matchNum).set(push, { + merge: true + }); + }); +} + + + +function subRes() { + firebase.firestore().collection('teamData').doc('team-' + document.getElementById('tns').value).get().then(function(doc) { + if (doc.exists) { + comp = doc.data()['currentCompetition']; + } + }).then(function() { + + + var user = firebase.auth().currentUser; + push = {} + push['match'] = 'match-' + document.getElementById('mn').value + push['teamDBRef'] = 'team-' + document.getElementById('tsn').value + push['speed'] = document.getElementById('speed').value + push['sandstormCross'] = document.getElementById('SCross').value + push['strategy'] = document.getElementById('strat').value + push['contrubution'] = document.getElementById('contrib').value + push['startingHatch'] = document.getElementById('habs').value + push['size'] = document.getElementById('egs').value + + push['fillChoice'] = document.getElementById('SFill').value + push['functional'] = document.getElementById('DOA').value + push['strongMedium'] = document.getElementById('SSO').value + push['sandstormCrossBonus'] = document.getElementById('SCross').value + + push['fillChoiceTeleop'] = document.getElementById('TFill').value + push['strongMediumTeleop'] = document.getElementById('TSO').value + + push['cargoSuccessTeleop'] = document.getElementById('CSSR').value + push['hiRocketSuccessTeleop'] = document.getElementById('HRSR').value + push['lowRocketSuccessTeleop'] = document.getElementById('LRSR').value + + push['endingHab'] = document.getElementById('HAB').value + + firebase.firestore().collection("teamData").doc('team-' + document.getElementById('tns').value).collection('scouts').doc(user.uid).collection(comp).doc("team-" + document.getElementById('tsn').value + "-match-" + document.getElementById('mn').value).set(push, { + merge: true + }) + }).then(function() { + var user = firebase.auth().currentUser; + push = {} + push['match'] = 'match-' + document.getElementById('mn').value + push['teamDBRef'] = 'team-' + document.getElementById('tsn').value + push['speed'] = document.getElementById('speed').value + push['sandstormCross'] = document.getElementById('SCross').value + push['strategy'] = document.getElementById('strat').value + push['contrubution'] = document.getElementById('contrib').value + push['startingHatch'] = document.getElementById('habs').value + push['size'] = document.getElementById('egs').value + + push['fillChoice'] = document.getElementById('SFill').value + push['functional'] = document.getElementById('DOA').value + push['strongMedium'] = document.getElementById('SSO').value + push['sandstormCrossBonus'] = document.getElementById('SCross').value + + push['fillChoiceTeleop'] = document.getElementById('TFill').value + push['strongMediumTeleop'] = document.getElementById('TSO').value + + push['cargoSuccessTeleop'] = document.getElementById('CSSR').value + push['hiRocketSuccessTeleop'] = document.getElementById('HRSR').value + push['lowRocketSuccessTeleop'] = document.getElementById('LRSR').value + + push['endingHab'] = document.getElementById('HAB').value + firebase.firestore().collection("data").doc('team-' + document.getElementById('tns').value).collection(comp).doc("team-" + document.getElementById('tsn').value).collection('matches').doc('match-' + document.getElementById('mn').value).set(push, { + merge: true + }) + } + + ).then(function() { + alert('Submitted!') + setTimeout(function() { + window.location.href = '../scout'; + }, 500); + + }) +}*/ diff --git a/website/public/scout/signUps/index.html b/website/public/scout/signUps/index.html deleted file mode 100644 index 2616b299..00000000 --- a/website/public/scout/signUps/index.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - <meta charset="utf-8"> - <title>titanscout - - - - - - - - - - -
- - - -

TitanScout- Scout Matches

-

Loading...

-
- Scouting For: -
-

Sign Up For Matches

- - - - - - - - - - - -
Match NumberSeriesFar BlueMid BlueNear BlueFar RedMid RedNear Red
-
-
- - - diff --git a/website/public/scout/signUps/scripts.js b/website/public/scout/signUps/scripts.js deleted file mode 100644 index 908495f1..00000000 --- a/website/public/scout/signUps/scripts.js +++ /dev/null @@ -1,214 +0,0 @@ -/* Set the width of the side navigation to 250px and the left margin of the page content to 250px and add a black background color to body */ -function openNav() { - document.getElementById("mySidenav").style.width = "250px"; - document.getElementById("main").style.marginLeft = "250px"; - document.body.style.backgroundColor = "rgba(0,0,0,0.4)"; -} - -/* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */ -function closeNav() { - document.getElementById("mySidenav").style.width = "0"; - document.getElementById("main").style.marginLeft = "0"; - document.body.style.backgroundColor = "white"; -} - -window.onload = function() { - document.getElementById('sideload').style.display = 'block'; - var config = { - apiKey: "(insert the TitanScout Api Key Here)", - authDomain: "titanscoutandroid.firebaseapp.com", - databaseURL: "https://titanscoutandroid.firebaseio.com", - projectId: "titanscoutandroid", - storageBucket: "titanscoutandroid.appspot.com", - messagingSenderId: "1097635313476" - }; - //eventually find a less-jank way to do this tho - firebase.initializeApp(config); - firebase.auth().onAuthStateChanged(function(user) { - if (user != null) { - if (user.displayName != null) { - document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName; - } else if (user.email != null) { - document.getElementById('status').innerHTML = "You are signed in as: " + user.email; - } else if (user.phoneNumber != null) { - document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber; - } else { - document.getElementById('status').innerHTML = "You are signed in."; - } - } else { - window.location.replace('../../'); - } - teamAssoc = firebase.firestore().collection('UserAssociations').doc(user.uid); - teamAssoc.get().then(function(doc) { - if (doc.exists) { - list = doc.data() - teamNums = Object.keys(list) - document.getElementById('tns').innerHTML = "" - for (var i = 0; i < teamNums.length; i++) { - document.getElementById('tns').innerHTML += "" - } - } else {} - }).then(function() { - changeTeam(document.getElementById('tns').value) - }) - }); -} - -function changeTeam(teamNum) { - document.getElementById("matchTable").innerHTML = ` - Match Number - Series - Far Blue - Mid Blue - Near Blue - Far Red - Mid Red - Near Red - `; - ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); - currentComp = null; - ti.get().then(function(doc) { - if (doc.exists) { - info = doc.data(); - currentComp = info['currentCompetition']; - } else { - alert("Something's wrong with firebase."); - throw ("Something's wrong with firebase."); - } - }).then(function() { - cci = firebase.firestore().collection('matchSignupsTeam').doc("team-" + teamNum).collection('competitions').doc(currentComp); - cci.get().then(function(doc) { - if (doc.exists) { - compInfo = doc.data(); - matches = Object.keys(compInfo); - matches.sort(); - var nr = [], - mr = [], - fr = [], - nb = [], - mb = [], - fb = []; - for (var i = 0; i < matches.length; i++) { - mi = compInfo["match-" + (i + 1).toString()] - //sets up the table lists. i really hope it doesn't break. - for (var j = 0; j < 2; j++) { - if (mi['far-blue']['series-' + (j + 1).toString()] != null) { - fb.push(mi['far-blue']['series-' + (j + 1).toString()]); - } else { - fb.push(`open`); - } - if (mi['mid-blue']['series-' + (j + 1).toString()] != null) { - mb.push(mi['mid-blue']['series-' + (j + 1).toString()]); - } else { - mb.push(`open`); - } - if (mi['near-blue']['series-' + (j + 1).toString()] != null) { - nb.push(mi['near-blue']['series-' + (j + 1).toString()]); - } else { - nb.push(`open`); - } - if (mi['far-red']['series-' + (j + 1).toString()] != null) { - fr.push(mi['far-red']['series-' + (j + 1).toString()]); - } else { - fr.push(`open`); - } - if (mi['mid-red']['series-' + (j + 1).toString()] != null) { - mr.push(mi['mid-red']['series-' + (j + 1).toString()]); - } else { - mr.push(`open`); - } - if (mi['near-red']['series-' + (j + 1).toString()] != null) { - nr.push(mi['near-red']['series-' + (j + 1).toString()]); - } else { - nr.push(`open`) - } - } - var outstr = ""; - outstr += "Quals " + (i + 1).toString() + ""; - outstr += "Series 1"; - outstr += "" + fb[0] + ""; - outstr += "" + mb[0] + ""; - outstr += "" + nb[0] + ""; - outstr += "" + fr[0] + ""; - outstr += "" + mr[0] + ""; - outstr += "" + nr[0] + ""; - outstr += "" - for (var k = 1; k < 2; k++) { - outstr += ""; - outstr += "Series " + (k + 1).toString() + ""; - outstr += "" + fb[k] + ""; - outstr += "" + mb[k] + ""; - outstr += "" + nb[k] + ""; - outstr += "" + fr[k] + ""; - outstr += "" + mr[k] + ""; - outstr += "" + nr[k] + ""; - outstr += "" - } - document.getElementById('matchTable').innerHTML += outstr; - } - } - }); - }); -} - -function addMatch(matchNum, seriesNum, position) { - var success = false; - var teamNum = document.getElementById('tns').value - var user = firebase.auth().currentUser; - var name = "anon" - if (user.displayName != null) { - name = user.displayName; - } else if (user.email != null) { - name = user.email; - } else if (user.phoneNumber != null) { - name = user.phoneNumber; - } - ti = firebase.firestore().collection('teamData').doc("team-" + teamNum); - currentComp = null; - ti.get().then(function(doc) { - if (doc.exists) { - info = doc.data(); - currentComp = info['currentCompetition']; - } else { - alert("Something's wrong with firebase."); - throw ("Something's wrong with firebase."); - } - }).then(function() { - cci = firebase.firestore().collection('matchSignupsTeam').doc("team-" + teamNum).collection('competitions').doc(currentComp); - cci.get().then(function(doc) { - if (doc.exists) { - info = doc.data(); - match = info["match-" + matchNum.toString()]; - pos = match[position]; - occ = pos["series-" + seriesNum.toString()]; - if (occ == null) { - info["match-" + matchNum.toString()][position]["series-" + seriesNum.toString()] = name; - firebase.firestore().collection('matchSignupsTeam').doc("team-" + teamNum).collection('competitions').doc(currentComp).set(info) - success = true; - } else { - alert(occ + "has added that match first.") - setTimeout(function() { - window.location.href = '../signUps'; - }, 500); - } - } - }).then(function() { - if (success) { - ti = firebase.firestore().collection('matchSignupsIndividual').doc(user.uid).collection("team-" + teamNum).doc(currentComp); - var push = {} - push["match-" + matchNum.toString() + " " + position] = { - 'completed': false, - 'series': seriesNum.toString() - } - ti.set(push, { - merge: true - }).then(function() { - alert('Added!') - setTimeout(function() { - window.location.href = '../signUps'; - }, 500); - }); - } - }); - }); -} diff --git a/website/public/stats/index.html b/website/public/stats/index.html index 7d3c1a6b..d676b712 100644 --- a/website/public/stats/index.html +++ b/website/public/stats/index.html @@ -10,16 +10,15 @@ +
@@ -28,7 +27,10 @@

TitanScout- Tournament Statistics

Loading...

- Live stats aren't ready let. Download the latest report. +

Scouting Report

+ +

Scouting Presentation

+
diff --git a/website/public/team/index.html b/website/public/team/index.html index 1fce5365..e134f717 100644 --- a/website/public/team/index.html +++ b/website/public/team/index.html @@ -16,11 +16,9 @@