test bugfix

This commit is contained in:
Jacob Levine 2019-03-07 19:47:35 -06:00
parent 3e76c55801
commit b0782ed74e

View File

@ -98,36 +98,36 @@ function checkKeyMatch(dt,tn,key){
}
function reqjt(tn,tc){
user=firebase.auth().currentUser;
dict={}
firebase.firestore().collection('teamData').doc('joinCodes').get().then(function(doc){
if (doc.exists) {
dict=doc.data();
if (checkKeyMatch(dict,tn,tc)){
push={};
push[tn]='scout';
firebase.firestore().collection("UserAssociations").doc(user.uid).set(push, {
merge: true
}).then(function(doc) {
if (doc.exists) {
list = doc.data()
teamNums = Object.keys(list)
document.getElementById('teammem').innerHTML = ""
for (var i = 0; i < teamNums.length; i++) {
document.getElementById('teammem').innerHTML += "<tr><td>" + teamNums[i] + "</td><td>" + list[teamNums[i]] + "</td></tr>"
}
} else {
document.getElementById('teammem').innerHTML = "<tr><td>You are not part of any teams</td></tr>"
}
})
}else{
alert("You don't have a correct join key. Please check it and try again.")
console.log(dict)
}
} else {
// doc.data() will be undefined in this case
console.log("No such document!");
}
});
if (checkKeyMatch(dict,tn,tc)){
push={};
push[tn]='scout';
firebase.firestore().collection("UserAssociations").doc(user.uid).set(push, {
merge: true
}).then(function(doc) {
if (doc.exists) {
list = doc.data()
teamNums = Object.keys(list)
document.getElementById('teammem').innerHTML = ""
for (var i = 0; i < teamNums.length; i++) {
document.getElementById('teammem').innerHTML += "<tr><td>" + teamNums[i] + "</td><td>" + list[teamNums[i]] + "</td></tr>"
}
} else {
document.getElementById('teammem').innerHTML = "<tr><td>You are not part of any teams</td></tr>"
}
})
}else{
alert("You don't have a correct join key. Please check it and try again.")
console.log(dict)
}
}
function signout() {