testing mistakes

This commit is contained in:
Jacob Levine 2019-03-22 07:01:19 -05:00
parent cbe1d9a015
commit 313d627fa8
2 changed files with 43 additions and 44 deletions

View File

@ -36,8 +36,8 @@
Match: <select id="mselect" onchange="cmatch(document.getElementById('mselect').value)"></select> Match: <select id="mselect" onchange="cmatch(document.getElementById('mselect').value)"></select>
Team: <select id="tselect"></Select> Team: <select id="tselect"></Select>
Series: <select id="sselect" onchange="cseries(document.getElementById('sselect').value)"> Series: <select id="sselect" onchange="cseries(document.getElementById('sselect').value)">
<option value="quantitative">Quantitative</option> <option value="quanttiative">Quantitative</option>
<option value="qualitative">Qualitative</option> <option value="Qualitative">Qualitative</option>
</select> </select>
</div> </div>
<div id=FormData> <div id=FormData>

View File

@ -313,7 +313,6 @@ function dec(id) {
function inc(id) { function inc(id) {
document.getElementById(id).innerHTML = "<input type='button' onclick=\"dec('" + id + "')\" value='-'></input>"+(parseInt(document.getElementById(id).textContent) + 1).toString()+"<input type='button' onclick=\"inc('" + id + "')\" value='+'></input>" document.getElementById(id).innerHTML = "<input type='button' onclick=\"dec('" + id + "')\" value='-'></input>"+(parseInt(document.getElementById(id).textContent) + 1).toString()+"<input type='button' onclick=\"inc('" + id + "')\" value='+'></input>"
} }
function capitalizeFirstLetter(string) { function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1); return string.charAt(0).toUpperCase() + string.slice(1);
} }
@ -337,44 +336,44 @@ function subReport() {
var matchNum = document.getElementById('mselect').value; var matchNum = document.getElementById('mselect').value;
var series = capitalizeFirstLetter(document.getElementById('sselect').value); var series = capitalizeFirstLetter(document.getElementById('sselect').value);
var push = {} var push = {}
push[series] = {} push[series+'-'+user.uid]={}
var x = document.getElementById('repsec1').children; var x = document.getElementById('repsec1').children;
for (var i = 0; i < x.length; i++) { for (var i = 0; i < x.length; i++) {
if (x[i].children[0].tagName == "INPUT") { if (x[i].children[0].tagName == "INPUT") {
push[series][x[i].children[0].id] = x[i].children[0].tagName; push[series+'-'+user.uid][x[i].children[0].id] = x[i].children[0].tagName;
} else if (x[i].children[0].tagName == "SPAN") { } else if (x[i].children[0].tagName == "SPAN") {
push[series][x[i].children[0].id] = x[i].children[0].innerText; push[series+'-'+user.uid][x[i].children[0].id] = x[i].children[0].innerText;
} else if (x[i].children[0].tagName == "DIV") { } else if (x[i].children[0].tagName == "DIV") {
var name = x[i].children[0].id; var name = x[i].children[0].id;
push[series][name] = document.querySelector('input[name="' + name + '"]:checked').value; push[series+'-'+user.uid][name] = document.querySelector('input[name="' + name + '"]:checked').value;
}else if (x[i].children[1].tagName == "TEXTAREA") { }else if (x[i].children[1].tagName == "TEXTAREA") {
push[series][x[i].children[1].id] = x[i].children[1].innerHTML; push[series+'-'+user.uid][x[i].children[1].id] = x[i].children[1].innerHTML;
} }
} }
var x = document.getElementById('repsec2').children; var x = document.getElementById('repsec2').children;
for (var i = 0; i < x.length; i++) { for (var i = 0; i < x.length; i++) {
if (x[i].children[0].tagName == "INPUT") { if (x[i].children[0].tagName == "INPUT") {
push[series][x[i].children[0].id] = x[i].children[0].tagName; push[series+'-'+user.uid][x[i].children[0].id] = x[i].children[0].tagName;
} else if (x[i].children[0].tagName == "SPAN") { } else if (x[i].children[0].tagName == "SPAN") {
push[series][x[i].children[0].id] = x[i].children[0].innerText; push[series+'-'+user.uid][x[i].children[0].id] = x[i].children[0].innerText;
} else if (x[i].children[0].tagName == "DIV") { } else if (x[i].children[0].tagName == "DIV") {
var name = x[i].children[0].id; var name = x[i].children[0].id;
push[series][name] = document.querySelector('input[name="' + name + '"]:checked').value; push[series+'-'+user.uid][name] = document.querySelector('input[name="' + name + '"]:checked').value;
}else if (x[i].children[1].tagName == "TEXTAREA") { }else if (x[i].children[1].tagName == "TEXTAREA") {
push[series][x[i].children[1].id] = x[i].children[1].innerHTML; push[series+'-'+user.uid][x[i].children[1].id] = x[i].children[1].innerHTML;
} }
} }
var x = document.getElementById('repsec3').children; var x = document.getElementById('repsec3').children;
for (var i = 0; i < x.length; i++) { for (var i = 0; i < x.length; i++) {
if (x[i].children[0].tagName == "INPUT") { if (x[i].children[0].tagName == "INPUT") {
push[series][x[i].children[0].id] = x[i].children[0].tagName; push[series+'-'+user.uid][x[i].children[0].id] = x[i].children[0].tagName;
} else if (x[i].children[0].tagName == "SPAN") { } else if (x[i].children[0].tagName == "SPAN") {
push[series][x[i].children[0].id] = x[i].children[0].innerText; push[series+'-'+user.uid][x[i].children[0].id] = x[i].children[0].innerText;
} else if (x[i].children[0].tagName == "DIV") { } else if (x[i].children[0].tagName == "DIV") {
var name = x[i].children[0].id; var name = x[i].children[0].id;
push[series][name] = document.querySelector('input[name="' + name + '"]:checked').value; push[series+'-'+user.uid][name] = document.querySelector('input[name="' + name + '"]:checked').value;
}else if (x[i].children[1].tagName == "TEXTAREA") { }else if (x[i].children[1].tagName == "TEXTAREA") {
push[series][x[i].children[1].id] = x[i].children[1].innerHTML; push[series+'-'+user.uid][x[i].children[1].id] = x[i].children[1].innerHTML;
} }
} }
firebase.firestore().collection("data").doc('team-' + document.getElementById('tns').value).collection(currentComp).doc("team-" + teamNum).collection('matches').doc('match-' + matchNum).set(push, { firebase.firestore().collection("data").doc('team-' + document.getElementById('tns').value).collection(currentComp).doc("team-" + teamNum).collection('matches').doc('match-' + matchNum).set(push, {