Created
July 2, 2019 14:20
-
-
Save nurfarazi/2a880f1c69211f296d525d98c862ee94 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resetScore(): Promise<void> { | |
return this.usersCollectionRef.ref.get().then(resp => { | |
console.log(resp.docs) | |
let batch = this.afs.firestore.batch(); | |
resp.docs.forEach(userDocRef => { | |
batch.update(userDocRef.ref, {'score': 0, 'leadsWithSalesWin': 0, 'leadsReported': 0}); | |
}) | |
batch.commit().catch(err => console.error(err)); | |
}).catch(error => console.error(error)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment