From 66434fc9d6ee0cd082fd9b757b3aa4c648224702 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Tue, 17 May 2022 16:08:55 -0600 Subject: [PATCH] Get answer outcome from comment --- functions/src/on-create-comment.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/functions/src/on-create-comment.ts b/functions/src/on-create-comment.ts index 18fc6757..dc7b7225 100644 --- a/functions/src/on-create-comment.ts +++ b/functions/src/on-create-comment.ts @@ -47,6 +47,13 @@ export const onCreateComment = functions.firestore contract.outcomeType === 'FREE_RESPONSE' && contract.answers ? contract.answers.find((answer) => answer.id === bet?.outcome) : undefined + } else if (comment.answerOutcome) { + answer = + contract.outcomeType === 'FREE_RESPONSE' && contract.answers + ? contract.answers?.find( + (answer) => answer.id === comment.answerOutcome + ) + : undefined } const comments = await getValues(