This commit is contained in:
Jacob Levine 2019-03-07 23:29:16 -06:00
parent 6247c7997f
commit b89fab51c3

View File

@ -54,76 +54,77 @@ window.onload = function() {
function subRes() { function subRes() {
firebase.firestore().collection('teamData').doc('team-' + document.getElementById('tns').value).get().then(function(doc) { firebase.firestore().collection('teamData').doc('team-' + document.getElementById('tns').value).get().then(function(doc) {
if (doc.exists) { if (doc.exists) {
comp = doc.data()['currentCompetition']; comp = doc.data()['currentCompetition'];
).then(function() { }
}).then(function() {
var user = firebase.auth().currentUser; var user = firebase.auth().currentUser;
push = {} push = {}
push['match'] = 'match-' + document.getElementById('mn').value push['match'] = 'match-' + document.getElementById('mn').value
push['teamDBRef'] = 'team-' + document.getElementById('tsn').value push['teamDBRef'] = 'team-' + document.getElementById('tsn').value
push['speed'] = document.getElementById('speed').value push['speed'] = document.getElementById('speed').value
push['sandstormCross'] = document.getElementById('SCross').value push['sandstormCross'] = document.getElementById('SCross').value
push['sandstormCargoShipHatchSuccess'] = document.getElementById('SCHS').value push['sandstormCargoShipHatchSuccess'] = document.getElementById('SCHS').value
push['sandstormCargoShipHatchFailure'] = document.getElementById('SCHU').value push['sandstormCargoShipHatchFailure'] = document.getElementById('SCHU').value
push['sandstormRocketHatchSuccess'] = document.getElementById('SRHS').value push['sandstormRocketHatchSuccess'] = document.getElementById('SRHS').value
push['sandstormRocketHatchFailure'] = document.getElementById('SRHU').value push['sandstormRocketHatchFailure'] = document.getElementById('SRHU').value
push['sandstormCargoShipCargoSuccess'] = document.getElementById('SCCS').value push['sandstormCargoShipCargoSuccess'] = document.getElementById('SCCS').value
push['sandstormCargoShipCargoFailure'] = document.getElementById('SCCU').value push['sandstormCargoShipCargoFailure'] = document.getElementById('SCCU').value
push['sandstormRocketCargoSuccess'] = document.getElementById('SRCS').value push['sandstormRocketCargoSuccess'] = document.getElementById('SRCS').value
push['sandstormRocketCargoFailure'] = document.getElementById('SRHU').value push['sandstormRocketCargoFailure'] = document.getElementById('SRHU').value
push['teleOpCargoShipHatchSuccess'] = document.getElementById('TCHS').value push['teleOpCargoShipHatchSuccess'] = document.getElementById('TCHS').value
push['teleOpCargoShipHatchFailure'] = document.getElementById('TCHU').value push['teleOpCargoShipHatchFailure'] = document.getElementById('TCHU').value
push['teleOpRocketHatchSuccess'] = document.getElementById('TRHS').value push['teleOpRocketHatchSuccess'] = document.getElementById('TRHS').value
push['teleOpRocketHatchFailure'] = document.getElementById('TRHU').value push['teleOpRocketHatchFailure'] = document.getElementById('TRHU').value
push['teleOpCargoShipCargoSuccess'] = document.getElementById('TCCS').value push['teleOpCargoShipCargoSuccess'] = document.getElementById('TCCS').value
push['teleOpCargoShipCargoFailure'] = document.getElementById('SCCU').value push['teleOpCargoShipCargoFailure'] = document.getElementById('SCCU').value
push['teleOpRocketCargoSuccess'] = document.getElementById('TRCS').value push['teleOpRocketCargoSuccess'] = document.getElementById('TRCS').value
push['teleOpRocketCargoFailure'] = document.getElementById('TRHU').value push['teleOpRocketCargoFailure'] = document.getElementById('TRHU').value
push['HABClimb'] = document.getElementById('HAB').value push['HABClimb'] = 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, { 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 merge: true
}) })
}).then(function() { }).then(function() {
var user = firebase.auth().currentUser; var user = firebase.auth().currentUser;
push = {} push = {}
push['match'] = 'match-' + document.getElementById('mn').value push['match'] = 'match-' + document.getElementById('mn').value
push['teamDBRef'] = 'team-' + document.getElementById('tsn').value push['teamDBRef'] = 'team-' + document.getElementById('tsn').value
push['speed'] = document.getElementById('speed').value push['speed'] = document.getElementById('speed').value
push['sandstormCross'] = document.getElementById('SCross').value push['sandstormCross'] = document.getElementById('SCross').value
push['sandstormCargoShipHatchSuccess'] = document.getElementById('SCHS').value push['sandstormCargoShipHatchSuccess'] = document.getElementById('SCHS').value
push['sandstormCargoShipHatchFailure'] = document.getElementById('SCHU').value push['sandstormCargoShipHatchFailure'] = document.getElementById('SCHU').value
push['sandstormRocketHatchSuccess'] = document.getElementById('SRHS').value push['sandstormRocketHatchSuccess'] = document.getElementById('SRHS').value
push['sandstormRocketHatchFailure'] = document.getElementById('SRHU').value push['sandstormRocketHatchFailure'] = document.getElementById('SRHU').value
push['sandstormCargoShipCargoSuccess'] = document.getElementById('SCCS').value push['sandstormCargoShipCargoSuccess'] = document.getElementById('SCCS').value
push['sandstormCargoShipCargoFailure'] = document.getElementById('SCCU').value push['sandstormCargoShipCargoFailure'] = document.getElementById('SCCU').value
push['sandstormRocketCargoSuccess'] = document.getElementById('SRCS').value push['sandstormRocketCargoSuccess'] = document.getElementById('SRCS').value
push['sandstormRocketCargoFailure'] = document.getElementById('SRHU').value push['sandstormRocketCargoFailure'] = document.getElementById('SRHU').value
push['teleOpCargoShipHatchSuccess'] = document.getElementById('TCHS').value push['teleOpCargoShipHatchSuccess'] = document.getElementById('TCHS').value
push['teleOpCargoShipHatchFailure'] = document.getElementById('TCHU').value push['teleOpCargoShipHatchFailure'] = document.getElementById('TCHU').value
push['teleOpRocketHatchSuccess'] = document.getElementById('TRHS').value push['teleOpRocketHatchSuccess'] = document.getElementById('TRHS').value
push['teleOpRocketHatchFailure'] = document.getElementById('TRHU').value push['teleOpRocketHatchFailure'] = document.getElementById('TRHU').value
push['teleOpCargoShipCargoSuccess'] = document.getElementById('TCCS').value push['teleOpCargoShipCargoSuccess'] = document.getElementById('TCCS').value
push['teleOpCargoShipCargoFailure'] = document.getElementById('SCCU').value push['teleOpCargoShipCargoFailure'] = document.getElementById('SCCU').value
push['teleOpRocketCargoSuccess'] = document.getElementById('TRCS').value push['teleOpRocketCargoSuccess'] = document.getElementById('TRCS').value
push['teleOpRocketCargoFailure'] = document.getElementById('TRHU').value push['teleOpRocketCargoFailure'] = document.getElementById('TRHU').value
push['HABClimb'] = document.getElementById('HAB').value push['HABClimb'] = document.getElementById('HAB').value
firebase.firestore().collection("data").doc('team-' + document.getElementById('tns').value).collection(comp).doc("team-" + document.getElementById('tsn').value).collection(comp).doc("team-" + document.getElementById('tsn').value).collection('matches').doc('match-' + document.getElementById('mn').value).set(push, { firebase.firestore().collection("data").doc('team-' + document.getElementById('tns').value).collection(comp).doc("team-" + document.getElementById('tsn').value).collection(comp).doc("team-" + document.getElementById('tsn').value).collection('matches').doc('match-' + document.getElementById('mn').value).set(push, {
merge: true merge: true
})
}
).then(function() {
alert('Submitted!')
window.location.href = '../scout'
}) })
} }
).then(function() {
alert('Submitted!')
window.location.href = '../scout'
}) })
} }
})
}