From 0edab2cbeb6878693b0171af9ee7378f6115f70a Mon Sep 17 00:00:00 2001 From: halcyonjac Date: Fri, 20 Sep 2024 09:32:10 +0100 Subject: [PATCH] filter ignored fields when copying exercise --- src/store/exercise/document.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/store/exercise/document.js b/src/store/exercise/document.js index 1aa029df1..710aa4da3 100644 --- a/src/store/exercise/document.js +++ b/src/store/exercise/document.js @@ -73,6 +73,14 @@ export default { data.favouriteOf = arrayUnion(rootState.auth.currentUser.uid); data.createdBy = rootState.auth.currentUser.uid; data.createdAt = serverTimestamp(); + + const ignoreFields = ['_applicationRecords', '_applications', '_approval', 'testingState']; + for (const key in data) { + if (ignoreFields.includes(key)) { + delete data[key]; + } + } + transaction.set(exerciseRef, getExerciseSaveData(data, data)); return exerciseRef.id; });