v1.1.0/release functions
(fix lint, build, ignore script)
This commit is contained in:
@@ -0,0 +1,185 @@
|
||||
const admin = require("firebase-admin");
|
||||
const firebaseSecret = require("../src/firebaseSecret.json");
|
||||
|
||||
|
||||
admin.initializeApp({
|
||||
credential: admin.credential.cert(firebaseSecret),
|
||||
});
|
||||
|
||||
const VAX_NAMES = {
|
||||
PB: "Pfizer-BioNTech",
|
||||
MD: "Moderna",
|
||||
JJ: "J&J Janssen",
|
||||
};
|
||||
|
||||
const VAX_DOSES = {
|
||||
ONE: "Dose 1",
|
||||
TWO: "Dose 2",
|
||||
};
|
||||
|
||||
const VAX_AGES = {
|
||||
"Pfizer-BioNTech": {
|
||||
YOUNGER: "18 - 55",
|
||||
OLDER: "56 & Older",
|
||||
},
|
||||
"Moderna": {
|
||||
YOUNGER: "18 - 64",
|
||||
OLDER: "65 & Older",
|
||||
},
|
||||
"J&J Janssen": {
|
||||
YOUNGER: "18 - 59",
|
||||
OLDER: "60 & Older",
|
||||
},
|
||||
};
|
||||
|
||||
// PFIZER COUNTS
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.PB)
|
||||
.where("dose", "in", [VAX_DOSES.ONE, VAX_DOSES.TWO])
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.PB].YOUNGER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("PB_ONE_YOUNGER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.PB)
|
||||
.update({
|
||||
[`${VAX_DOSES.ONE}.${VAX_AGES[VAX_NAMES.PB].YOUNGER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.PB)
|
||||
.where("dose", "==", VAX_DOSES.TWO)
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.PB].YOUNGER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("PB_TWO_YOUNGER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.PB)
|
||||
.update({
|
||||
[`${VAX_DOSES.TWO}.${VAX_AGES[VAX_NAMES.PB].YOUNGER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.PB)
|
||||
.where("dose", "in", [VAX_DOSES.ONE, VAX_DOSES.TWO])
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.PB].OLDER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("PB_ONE_OLDER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.PB)
|
||||
.update({
|
||||
[`${VAX_DOSES.ONE}.${VAX_AGES[VAX_NAMES.PB].OLDER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.PB)
|
||||
.where("dose", "==", VAX_DOSES.TWO)
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.PB].OLDER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("PB_TWO_OLDER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.PB)
|
||||
.update({
|
||||
[`${VAX_DOSES.TWO}.${VAX_AGES[VAX_NAMES.PB].OLDER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
// MODERNA COUNTS
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.MD)
|
||||
.where("dose", "in", [VAX_DOSES.ONE, VAX_DOSES.TWO])
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.MD].YOUNGER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("MD_ONE_YOUNGER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.MD)
|
||||
.update({
|
||||
[`${VAX_DOSES.ONE}.${VAX_AGES[VAX_NAMES.MD].YOUNGER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.MD)
|
||||
.where("dose", "==", VAX_DOSES.TWO)
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.MD].YOUNGER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("MD_TWO_YOUNGER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.MD)
|
||||
.update({
|
||||
[`${VAX_DOSES.TWO}.${VAX_AGES[VAX_NAMES.MD].YOUNGER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.MD)
|
||||
.where("dose", "in", [VAX_DOSES.ONE, VAX_DOSES.TWO])
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.MD].OLDER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("MD_ONE_OLDER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.MD)
|
||||
.update({
|
||||
[`${VAX_DOSES.ONE}.${VAX_AGES[VAX_NAMES.MD].OLDER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.MD)
|
||||
.where("dose", "==", VAX_DOSES.TWO)
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.MD].OLDER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("MD_TWO_OLDER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.MD)
|
||||
.update({
|
||||
[`${VAX_DOSES.TWO}.${VAX_AGES[VAX_NAMES.MD].OLDER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
// J&J COUNTS
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.JJ)
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.JJ].YOUNGER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("JJ_YOUNGER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.JJ)
|
||||
.update({
|
||||
[`${VAX_AGES[VAX_NAMES.JJ].YOUNGER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
admin.firestore().collection("results")
|
||||
.where("name", "==", VAX_NAMES.JJ)
|
||||
.where("age", "==", VAX_AGES[VAX_NAMES.JJ].OLDER)
|
||||
.get()
|
||||
.then((docs) => {
|
||||
console.log("JJ_OLDER", docs.docs.length);
|
||||
admin.firestore()
|
||||
.collection("stats")
|
||||
.doc(VAX_NAMES.JJ)
|
||||
.update({
|
||||
[`${VAX_AGES[VAX_NAMES.JJ].OLDER}.count`]:
|
||||
docs.docs.length,
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user