mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-10 15:04:45 +00:00
commit
3b95963eb1
1107
data analysis/.ipynb_checkpoints/analysis-checkpoint.py
Normal file
1107
data analysis/.ipynb_checkpoints/analysis-checkpoint.py
Normal file
File diff suppressed because it is too large
Load Diff
BIN
data analysis/__pycache__/analysis.cpython-36.pyc
Normal file
BIN
data analysis/__pycache__/analysis.cpython-36.pyc
Normal file
Binary file not shown.
@ -17,8 +17,10 @@
|
|||||||
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
||||||
<a href="#">Profile</a>
|
<a href="#">Profile</a>
|
||||||
<a href="../team">Team</a>
|
<a href="../team">Team</a>
|
||||||
<a href="../scout">Scout Matches</a>
|
<p>Scout Matches</p>
|
||||||
<a href="../stats">Torunament Stats</a>
|
<a href="../scout/signUps" class="scoutMatchLinks">Sign Up For Matches</a>
|
||||||
|
<a href="../scout/rpts" class="scoutMatchLinks">Submit Scouting Reports</a>
|
||||||
|
<a href="../stats">Tournament Stats</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<span onclick="openNav()" id="topbar">
|
<span onclick="openNav()" id="topbar">
|
||||||
|
@ -1,164 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en" dir="ltr">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>titanscout</title>
|
|
||||||
<script src="https://www.gstatic.com/firebasejs/5.7.2/firebase.js"></script>
|
|
||||||
<script src="https://cdn.firebase.com/libs/firebaseui/3.5.1/firebaseui.js"></script>
|
|
||||||
<link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/3.5.1/firebaseui.css" />
|
|
||||||
<link rel="stylesheet" href="../style.css" type="text/css" />
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
|
||||||
<script type="text/javascript" src="scripts.js"></script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="mySidenav" class="sidenav">
|
|
||||||
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
|
||||||
<a href="../profile">Profile</a>
|
|
||||||
<a href="../team">Team</a>
|
|
||||||
<a href="#">Scout Matches</a>
|
|
||||||
<a href="../stats">Torunament Stats</a>
|
|
||||||
</div>
|
|
||||||
<div id="main">
|
|
||||||
<span onclick="openNav()" id="topbar">
|
|
||||||
<img id="sideload" src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png">
|
|
||||||
</span>
|
|
||||||
<h1 id="mainhead">TitanScout- Scout Matches</h1>
|
|
||||||
<p id="status">Loading...</p>
|
|
||||||
<div>
|
|
||||||
Scouting For: <select id="tns"></select>
|
|
||||||
</div>
|
|
||||||
<h2>Submit a Report:</h2>
|
|
||||||
<div>
|
|
||||||
Match Number: <input type="text" name="" value="" id="mn">
|
|
||||||
Team Scouted: <input type="text" name="" value="" id="tsn">
|
|
||||||
</div>
|
|
||||||
<h3>General:</h3>
|
|
||||||
Speed: <select id="speed">
|
|
||||||
<option value="slow">Slow</option>
|
|
||||||
<option value="Medium">Medium</option>
|
|
||||||
<option value="Fast">Fast</option>
|
|
||||||
<option value="Ludicrous">Ludicrous</option>
|
|
||||||
</select>
|
|
||||||
<div>
|
|
||||||
Team Contribution: <select id="contrib">
|
|
||||||
<option value="Weak">Weak</option>
|
|
||||||
<option value="Equal">Equal</option>
|
|
||||||
<option value="Strong">Strong</option>
|
|
||||||
<option value="IDK" selected>IDK</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Endgame Size: <select class="" name="" id="egs">
|
|
||||||
<option value="Small">Small</option>
|
|
||||||
<option value="Medium">Medium</option>
|
|
||||||
<option value="Large">Large</option>
|
|
||||||
<option value="Jumbo">Jumbo</option>
|
|
||||||
<option value="IDK" selected>IDK</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
HAB Start:
|
|
||||||
<select class="" name="" id="habs">
|
|
||||||
<option value="None">None</option>
|
|
||||||
<option value="Hab I">Hab I</option>
|
|
||||||
<option value="Hab II">Hab II</option>
|
|
||||||
<option value="Hab III">Hab III</option>
|
|
||||||
<option value="IDK" selected>IDK</option>
|
|
||||||
</select>
|
|
||||||
<div>
|
|
||||||
Strategy: <input type="text" name="" value="" id="strat">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h3>Sandstorm:</h3>
|
|
||||||
<div>
|
|
||||||
Sandstorm Cross Bonus: <select id="SCross">
|
|
||||||
<option value="None" selected>None</option>
|
|
||||||
<option value="L1">Crossed Auto Line</option>
|
|
||||||
<option value="L2">Crossed Auto Line from HAB Level 2</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Strongest Object: <select id="SSO">
|
|
||||||
<option value="Neither" selected>Neither</option>
|
|
||||||
<option value="Ball">Cargo</option>
|
|
||||||
<option value="Hatch">Hatch Panels</option>
|
|
||||||
<option value="Both">Both</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Was Functional:
|
|
||||||
<select id="DOA">
|
|
||||||
<option value="Yes">Yes</option>
|
|
||||||
<option value="Sorta">Sorta</option>
|
|
||||||
<option value="No" selected>No</option>
|
|
||||||
<option value="IDK">IDK</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Fill Choice: <select id="SFill">
|
|
||||||
<option value="Low Rocket">Low-Mid Rocket</option>
|
|
||||||
<option value="High Rocket">Mid-High Rocket</option>
|
|
||||||
<option value="Cargo">Cargo Ship</option>
|
|
||||||
<option value="None" selected>None</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<h3>Tele-Op:</h3>
|
|
||||||
<div>
|
|
||||||
Strongest Object: <select id="TSO">
|
|
||||||
<option value="Neither" selected>Neither</option>
|
|
||||||
<option value="Ball">Cargo</option>
|
|
||||||
<option value="Hatch">Hatch Panels</option>
|
|
||||||
<option value="Both">Both</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Fill Choice: <select id="TFill">
|
|
||||||
<option value="Low Rocket">Low-Mid Rocket</option>
|
|
||||||
<option value="High Rocket">Mid-High Rocket</option>
|
|
||||||
<option value="Cargo">Cargo Ship</option>
|
|
||||||
<option value="None" selected>None</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Cargo Ship Success Rate: <select id="CSSR">
|
|
||||||
<option value="N/A" selected>N/A</option>
|
|
||||||
<option value="Low">Low</option>
|
|
||||||
<option value="Mid">Medium</option>
|
|
||||||
<option value="High">High</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
Low Rocket Success Rate: <select id="LRSR">
|
|
||||||
<option value="N/A" selected>N/A</option>
|
|
||||||
<option value="Low">Low</option>
|
|
||||||
<option value="Mid">Medium</option>
|
|
||||||
<option value="High">High</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
High Rocket Success Rate: <select id="HRSR">
|
|
||||||
<option value="N/A" selected>N/A</option>
|
|
||||||
<option value="Low">Low</option>
|
|
||||||
<option value="Mid">Medium</option>
|
|
||||||
<option value="High">High</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h3>Endgame:</h3>
|
|
||||||
<div>
|
|
||||||
HAB Climb: <select id="HAB">
|
|
||||||
<option value="None" selected>None</option>
|
|
||||||
<option value="L1">Level 1</option>
|
|
||||||
<option value="L2">Level 2</option>
|
|
||||||
<option value="L3">Level 3</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="button" value="Submit" onclick="subRes();">
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
46
website/public/scout/rpts/index.html
Normal file
46
website/public/scout/rpts/index.html
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" dir="ltr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>titanscout</title>
|
||||||
|
<script src="https://www.gstatic.com/firebasejs/5.7.2/firebase.js"></script>
|
||||||
|
<script src="https://cdn.firebase.com/libs/firebaseui/3.5.1/firebaseui.js"></script>
|
||||||
|
<link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/3.5.1/firebaseui.css" />
|
||||||
|
<link rel="stylesheet" href="../style.css" type="text/css" />
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="mySidenav" class="sidenav">
|
||||||
|
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
||||||
|
<a href="../../profile">Profile</a>
|
||||||
|
<a href="../../team">Team</a>
|
||||||
|
<p>Scout Matches</p>
|
||||||
|
<a href="../signUps" class="scoutMatchLinks">Sign Up For Matches</a>
|
||||||
|
<a href="#" class="scoutMatchLinks">Submit Scouting Reports</a>
|
||||||
|
<a href="../../stats">Tournament Stats</a>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<span onclick="openNav()" id="topbar">
|
||||||
|
<img id="sideload" src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png">
|
||||||
|
</span>
|
||||||
|
<h1 id="mainhead">TitanScout- Scout Matches</h1>
|
||||||
|
<p id="status">Loading...</p>
|
||||||
|
<div>
|
||||||
|
Scouting For: <select id="tns" onchange="changeTeam(document.getElementById('tns').value)"></select>
|
||||||
|
</div>
|
||||||
|
<h2>Submit a Report:</h2>
|
||||||
|
<select id="mSelect"></select>
|
||||||
|
Team Scouted: <input type="text" id="scoutedTeamNumber"></select>
|
||||||
|
<div id=FormData>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
271
website/public/scout/rpts/scripts.js
Normal file
271
website/public/scout/rpts/scripts.js
Normal file
@ -0,0 +1,271 @@
|
|||||||
|
/* 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 += "<option value='" + teamNums[i] + "'>" + teamNums[i] + "</option>"
|
||||||
|
}
|
||||||
|
} 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 += "<option value=" + name + series + ">" + name + "</option>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.getElementById('mSelect').addEventListener("change", function() {
|
||||||
|
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').document("team-" + teamNum).collection('competitions').document(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 += "<h3>"
|
||||||
|
seriesList[i].id + "</h3>";
|
||||||
|
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 += "<div>";
|
||||||
|
document.getElementById('FormData').innerHTML += questions[j][1]['title'];
|
||||||
|
if (questions[j][1]['type'] = 'shortText') {
|
||||||
|
document.getElementById('FormData').innerHTML += "<input id=''" + questions[j][0] + "' type='text'></input>";
|
||||||
|
} else if (questions[j][1]['type'] = 'longText') {
|
||||||
|
document.getElementById('FormData').innerHTML += "<textarea id=''" + questions[j][0] + "' rows='4' cols='50''></textarea>";
|
||||||
|
} else if (questions[j][1]['type'] = 'numerical') {
|
||||||
|
document.getElementById('FormData').innerHTML += "<span id='" + questions[j][0] + "'><input type='button' onclick='dec(" + questions[j][0] + ")' value='-'></input>" + (questions[j][1]['default']).toString() + "<input type='button' onclick='inc(" + questions[j][0] + ")' value='+'></input></span>";
|
||||||
|
} else if (questions[j][1]['type'] = 'range') {
|
||||||
|
document.getElementById('FormData').innerHTML += " " + questions[j][1]['min']['text'] + " ";
|
||||||
|
document.getElementById('FormData').innerHTML += "<input type='range' min='" + questions[j][1]['min']['val'] + "' max='" + questions[j][1]['max']['val'] + "'>";
|
||||||
|
document.getElementById('FormData').innerHTML += " " + questions[j][1]['max']['text'];
|
||||||
|
} else if (questions[j][1]['type'] = 'segment') {
|
||||||
|
document.getElementById('FormData').innerHTML += "<div id='" + questions[j][0] + "'>"
|
||||||
|
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 += "<input type='radio' name='" + questions[j][0] + "' value=" + questions[j][1]['elements'][k] + "></input>"
|
||||||
|
}
|
||||||
|
document.getElementById('FormData').innerHTML += "</div>"
|
||||||
|
}
|
||||||
|
document.getElementById('FormData').innerHTML += "</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.getElementById('FormData').innerHTML += "<input type='button' onclick=subReport(" + teamNum + "," + competition + "," + firstWord(locString) + ") value='Submit'>"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
})
|
||||||
|
}*/
|
@ -1,126 +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 += "<option value='" + teamNums[i] + "'>" + teamNums[i] + "</option>"
|
|
||||||
}
|
|
||||||
} else {}
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
53
website/public/scout/signUps/index.html
Normal file
53
website/public/scout/signUps/index.html
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" dir="ltr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>titanscout</title>
|
||||||
|
<script src="https://www.gstatic.com/firebasejs/5.7.2/firebase.js"></script>
|
||||||
|
<script src="https://cdn.firebase.com/libs/firebaseui/3.5.1/firebaseui.js"></script>
|
||||||
|
<link type="text/css" rel="stylesheet" href="https://cdn.firebase.com/libs/firebaseui/3.5.1/firebaseui.css" />
|
||||||
|
<link rel="stylesheet" href="../style.css" type="text/css" />
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
<script type="text/javascript" src="scripts.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="mySidenav" class="sidenav">
|
||||||
|
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
||||||
|
<a href="../../profile">Profile</a>
|
||||||
|
<a href="../../team">Team</a>
|
||||||
|
<p>Scout Matches</p>
|
||||||
|
<a href="../signUps" class="scoutMatchLinks">Sign Up For Matches</a>
|
||||||
|
<a href="../rpts" class="scoutMatchLinks">Submit Scouting Reports</a>
|
||||||
|
<a href="../../stats">Tournament Stats</a>
|
||||||
|
</div>
|
||||||
|
<div id="main">
|
||||||
|
<span onclick="openNav()" id="topbar">
|
||||||
|
<img id="sideload" src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png">
|
||||||
|
</span>
|
||||||
|
<h1 id="mainhead">TitanScout- Scout Matches</h1>
|
||||||
|
<p id="status">Loading...</p>
|
||||||
|
<div>
|
||||||
|
Scouting For: <select id="tns" onchange="changeTeam(document.getElementById('tns').value)"></select>
|
||||||
|
</div>
|
||||||
|
<h2>Sign Up For Matches</h2>
|
||||||
|
<table id="matchTable">
|
||||||
|
<tr>
|
||||||
|
<td class="neu">Match Number</td>
|
||||||
|
<td class="neu">Series</td>
|
||||||
|
<td class="blue">Far Blue</td>
|
||||||
|
<td class="blue">Mid Blue</td>
|
||||||
|
<td class="blue">Near Blue</td>
|
||||||
|
<td class="red">Far Red</td>
|
||||||
|
<td class="red">Mid Red</td>
|
||||||
|
<td class="red">Near Red</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
215
website/public/scout/signUps/scripts.js
Normal file
215
website/public/scout/signUps/scripts.js
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
/* 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 += "<option value='" + teamNums[i] + "'>" + teamNums[i] + "</option>"
|
||||||
|
}
|
||||||
|
} else {}
|
||||||
|
}).then(function() {
|
||||||
|
changeTeam(document.getElementById('tns').value)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeTeam(teamNum) {
|
||||||
|
document.getElementById("matchTable") = `<tr>
|
||||||
|
<td class="neu">Match Number</td>
|
||||||
|
<td class="neu">Series</td>
|
||||||
|
<td class="blue">Far Blue</td>
|
||||||
|
<td class="blue">Mid Blue</td>
|
||||||
|
<td class="blue">Near Blue</td>
|
||||||
|
<td class="red">Far Red</td>
|
||||||
|
<td class="red">Mid Red</td>
|
||||||
|
<td class="red">Near Red</td>
|
||||||
|
</tr>`;
|
||||||
|
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 = cci.get();
|
||||||
|
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; i++) {
|
||||||
|
if (mi['far-blue']['series-' + (j + 1).toString()] != null) {
|
||||||
|
fb.push(mi['far-blue']['series-' + (j + 1).toString()]);
|
||||||
|
} else {
|
||||||
|
fb.push("<span onclick='addMatch(" + (i + 1).toString() + "," + (j + 1).toString() + ",'far-blue')'>open</span>");
|
||||||
|
}
|
||||||
|
if (mi['mid-blue']['series-' + (j + 1).toString()] != null) {
|
||||||
|
mb.push(mi['mid-blue']['series-' + (j + 1).toString()]);
|
||||||
|
} else {
|
||||||
|
mb.push("<span onclick='addMatch(" + (i + 1).toString() + "+", (j + 1).toString() + ",'mid-blue')'>open</span>");
|
||||||
|
}
|
||||||
|
if (mi['near-blue']['series-' + (j + 1).toString()] != null) {
|
||||||
|
nb.push(mi['near-blue']['series-' + (j + 1).toString()]);
|
||||||
|
} else {
|
||||||
|
nb.push("<span onclick='addMatch(" + (i + 1).toString() + "," + (j + 1).toString() + ",'near-blue')'>open</span>");
|
||||||
|
}
|
||||||
|
if (mi['far-red']['series-' + (j + 1).toString()] != null) {
|
||||||
|
fr.push(mi['far-red']['series-' + (j + 1).toString()]);
|
||||||
|
} else {
|
||||||
|
fr.push("<span onclick='addMatch(" + (i + 1).toString() + "," + (j + 1).toString() + ",'far-red')'>open</span>");
|
||||||
|
}
|
||||||
|
if (mi['mid-red']['series-' + (j + 1).toString()] != null) {
|
||||||
|
mr.push(mi['mid-red']['series-' + (j + 1).toString()]);
|
||||||
|
} else {
|
||||||
|
mr.push("<span onclick='addMatch(" + (i + 1).toString() + "," + (j + 1).toString() + ",'mid-red')'>open</span>");
|
||||||
|
}
|
||||||
|
if (mi['near-red']['series-' + (j + 1).toString()] != null) {
|
||||||
|
nr.push(mi['near-red']['series-' + (j + 1).toString()]);
|
||||||
|
} else {
|
||||||
|
nr.push("<span onclick='addMatch(" + (i + 1).toString() + "," + (j + 1).toString() + ",'near-red')'>open</span>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var outstr = "";
|
||||||
|
outstr += "<tr><td rowspan='2' class='neu'>Quals " + (i + 1).toString() + "</td>";
|
||||||
|
outstr += "<td class='neu'>Series 1</tr>";
|
||||||
|
outstr += "<td class='blue'>" + fb[0] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + mb[0] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + nb[0] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + fr[0] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + mr[0] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + nr[0] + "</td>";
|
||||||
|
outstr += "</tr>"
|
||||||
|
for (var k = 1; k < 2; i++) {
|
||||||
|
outstr += "<tr>";
|
||||||
|
outstr += "<td class='neu'>Series " + (k + 1).toString() + "</tr>";
|
||||||
|
outstr += "<td class='blue'>" + fb[k] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + mb[k] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + nb[k] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + fr[k] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + mr[k] + "</td>";
|
||||||
|
outstr += "<td class='blue'>" + nr[k] + "</td>";
|
||||||
|
outstr += "</tr>"
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
push = {
|
||||||
|
"match-" + matchNum.toString()+" "+position: {
|
||||||
|
'completed': false,
|
||||||
|
series: seriesNum.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cityRef.set(push, {
|
||||||
|
merge: true
|
||||||
|
}), then(function() {
|
||||||
|
alert('Added!')
|
||||||
|
setTimeout(function() {
|
||||||
|
window.location.href = '../signUps';
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -15,9 +15,11 @@
|
|||||||
<div id="mySidenav" class="sidenav">
|
<div id="mySidenav" class="sidenav">
|
||||||
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
||||||
<a href="../profile">Profile</a>
|
<a href="../profile">Profile</a>
|
||||||
<a href="#">Team</a>
|
<a href="../team">Team</a>
|
||||||
<a href="../scout">Scout Matches</a>
|
<p>Scout Matches</p>
|
||||||
<a href="../stats">Torunament Stats</a>
|
<a href="../scout/signUps" class="scoutMatchLinks">Sign Up For Matches</a>
|
||||||
|
<a href="../scout/rpts" class="scoutMatchLinks">Submit Scouting Reports</a>
|
||||||
|
<a href="#">Tournament Stats</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<span onclick="openNav()" id="topbar">
|
<span onclick="openNav()" id="topbar">
|
||||||
|
@ -7,6 +7,14 @@ body{
|
|||||||
display: none;
|
display: none;
|
||||||
width:30px;
|
width:30px;
|
||||||
}
|
}
|
||||||
|
.blue{
|
||||||
|
background-color: #d1ecf1;
|
||||||
|
color: #0e0c60;
|
||||||
|
}
|
||||||
|
.red{
|
||||||
|
background-color: #f8d7da;
|
||||||
|
color: #b20515;
|
||||||
|
}
|
||||||
table{
|
table{
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
@ -46,7 +54,7 @@ td{
|
|||||||
|
|
||||||
/* The navigation menu links */
|
/* The navigation menu links */
|
||||||
.sidenav a {
|
.sidenav a {
|
||||||
padding: 8px 8px 8px 32px;
|
padding: 8px 8px 8px 30px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 25px;
|
font-size: 25px;
|
||||||
color: #818181;
|
color: #818181;
|
||||||
@ -58,6 +66,24 @@ td{
|
|||||||
.sidenav a:hover {
|
.sidenav a:hover {
|
||||||
color: #f1f1f1;
|
color: #f1f1f1;
|
||||||
}
|
}
|
||||||
|
/* The navigation menu links */
|
||||||
|
.sidenav p {
|
||||||
|
padding: 8px 8px 8px 32px;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 25px;
|
||||||
|
color: #818181;
|
||||||
|
display: block;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* When you mouse over the navigation links, change their color */
|
||||||
|
.sidenav p:hover {
|
||||||
|
color: #f1f1f1;
|
||||||
|
}
|
||||||
|
.scoutMatchLinks{
|
||||||
|
size: 20px;
|
||||||
|
padding: 6px 6px 8px 40px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Position and style the close button (top right corner) */
|
/* Position and style the close button (top right corner) */
|
||||||
.sidenav .closebtn {
|
.sidenav .closebtn {
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
|
||||||
<a href="../profile">Profile</a>
|
<a href="../profile">Profile</a>
|
||||||
<a href="#">Team</a>
|
<a href="#">Team</a>
|
||||||
<a href="../scout">Scout Matches</a>
|
<p>Scout Matches</p>
|
||||||
<a href="../stats">Torunament Stats</a>
|
<a href="../scout/signUps" class="scoutMatchLinks">Sign Up For Matches</a>
|
||||||
|
<a href="../scout/rpts" class="scoutMatchLinks">Submit Scouting Reports</a>
|
||||||
|
<a href="../stats">Tournament Stats</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<span onclick="openNav()" id="topbar">
|
<span onclick="openNav()" id="topbar">
|
||||||
|
Loading…
Reference in New Issue
Block a user