v1.0.1/release

copyright & privacy policy. fix update path bug
This commit is contained in:
2021-04-14 21:28:46 -04:00
parent eb63c9c48f
commit 3040c6f064
14 changed files with 573 additions and 63 deletions
+16 -9
View File
@@ -60,11 +60,11 @@ exports.saveResult = functions.https.onCall(async (data, context) => {
incrementValue = 1;
}
if (data.dose) {
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
updateDoc[`${data.dose}.${data.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(incrementValue);
}
else {
updateDoc[`${data.age}.${symptom}`] =
updateDoc[`${data.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(incrementValue);
}
});
@@ -86,11 +86,11 @@ exports.saveResult = functions.https.onCall(async (data, context) => {
symptom !== "age") {
if (existingData[symptom] === true) {
if (existingData.dose) {
undoDoc[`${existingData.dose}.${existingData.age}.${symptom}`] =
undoDoc[`${existingData.dose}.${existingData.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(-1);
}
else {
undoDoc[`${existingData.age}.${symptom}`] =
undoDoc[`${existingData.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(-1);
}
}
@@ -115,11 +115,11 @@ exports.saveResult = functions.https.onCall(async (data, context) => {
Object.keys(docData).forEach((symptom) => {
if (docData[symptom] === true) {
if (data.dose) {
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
updateDoc[`${data.dose}.${data.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(1);
}
else {
updateDoc[`${data.age}.${symptom}`] =
updateDoc[`${data.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(1);
}
}
@@ -145,11 +145,11 @@ exports.saveResult = functions.https.onCall(async (data, context) => {
Object.keys(docData).forEach((symptom) => {
if (docData[symptom] === true) {
if (data.dose) {
updateDoc[`${data.dose}.${data.age}.${symptom}`] =
updateDoc[`${data.dose}.${data.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(1);
}
else {
updateDoc[`${data.age}.${symptom}`] =
updateDoc[`${data.age}.${symptom.replace("/", "OR")}`] =
admin.firestore.FieldValue.increment(1);
}
}
@@ -165,12 +165,19 @@ exports.saveResult = functions.https.onCall(async (data, context) => {
exports.getPastResult = functions.https.onCall(async (data, context) => {
if (!!data && !!context) {
const { gid } = data;
return await admin
const existingData = await admin
.firestore()
.collection("results")
.doc(serializeGaId(gid))
.get()
.then((doc) => doc.data());
if (existingData) {
if (existingData["NAUSEA / VOMITING"]) {
existingData["NAUSEA OR VOMITING"] =
existingData["NAUSEA / VOMITING"];
}
return existingData;
}
}
return undefined;
});
File diff suppressed because one or more lines are too long