[FIX] cloud function backwards compatability
This commit is contained in:
@@ -171,7 +171,9 @@ exports.createProgress = functions.https.onCall((data, context) => {
|
|||||||
throw new functions.https.HttpsError("invalid-argument", "ignoreCaps must be a boolean");
|
throw new functions.https.HttpsError("invalid-argument", "ignoreCaps must be a boolean");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data.showNumberOfAnswers !== "boolean") {
|
if (typeof data.showNumberOfAnswers === "undefined") {
|
||||||
|
data.showNumberOfAnswers = false;
|
||||||
|
} else if (typeof data.showNumberOfAnswers !== "boolean") {
|
||||||
throw new functions.https.HttpsError("invalid-argument", "showNumberOfAnswers must be a boolean");
|
throw new functions.https.HttpsError("invalid-argument", "showNumberOfAnswers must be a boolean");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,8 +358,8 @@ exports.createProgressWithIncorrect = functions.https.onCall((data, context) =>
|
|||||||
typo: false,
|
typo: false,
|
||||||
setIds: progressData.setIds,
|
setIds: progressData.setIds,
|
||||||
set_titles: progressData.set_titles,
|
set_titles: progressData.set_titles,
|
||||||
ignoreCaps: progressData.ignoreCaps,
|
ignoreCaps: progressData.ignoreCaps === true ? progressData.ignoreCaps : false,
|
||||||
showNumberOfAnswers: progressData.showNumberOfAnswers,
|
showNumberOfAnswers: progressData.showNumberOfAnswers === true ? progressData.showNumberOfAnswers : false,
|
||||||
};
|
};
|
||||||
if (progressData.mode === "lives") {
|
if (progressData.mode === "lives") {
|
||||||
dataToSet.lives = progressData.start_lives;
|
dataToSet.lives = progressData.start_lives;
|
||||||
|
|||||||
Reference in New Issue
Block a user