@@ -112,7 +112,6 @@ const onVoteRequestUpdateV2 = onDocumentUpdated(
112112 totalCheckerTestersCount,
113113 } = await getVoteCounts ( messageRef )
114114
115-
116115 const isBigSus = susCount > thresholds . isBigSus * validResponsesCount
117116 const isSus =
118117 isBigSus || susCount > thresholds . isSus * validResponsesCount
@@ -170,9 +169,10 @@ const onVoteRequestUpdateV2 = onDocumentUpdated(
170169 thresholds . endVoteAbsolute //10
171170 ) )
172171
173- // Check if unacceptableCount is more than 50%
172+ // Check if unacceptableCount is more than 50%
174173 // if unacceptableCount > 50% of validResponsesCount and message is considered assessed
175- const isUnacceptable = ( unacceptableCount > 0.5 * validResponsesCount ) && isAssessed
174+ const isUnacceptable =
175+ unacceptableCount > 0.5 * validResponsesCount && isAssessed
176176 const isAssessedUnacceptable = isUnacceptable
177177
178178 let primaryCategory
@@ -313,6 +313,11 @@ const onVoteRequestUpdateV2 = onDocumentUpdated(
313313 }
314314 //update langfuse
315315 try {
316+ const checkId = messageSnap . get ( "checkId" )
317+ if ( ! checkId ) {
318+ functions . logger . error ( "Check ID not found" )
319+ throw new Error ( "Check ID not found, cannot log to langfuse" )
320+ }
316321 const communityNoteCategory = postChangeData . communityNoteCategory
317322
318323 if ( communityNoteCategory ) {
@@ -326,7 +331,7 @@ const onVoteRequestUpdateV2 = onDocumentUpdated(
326331 const checkerId = postChangeData . factCheckerDocRef . id
327332 await langfuse . score ( {
328333 id : `${ messageRef . id } -${ checkerId } ` ,
329- traceId : messageRef . id ,
334+ traceId : checkId ,
330335 name : "communityNoteRating" ,
331336 value : communityNoteCategory ,
332337 dataType : "CATEGORICAL" ,
0 commit comments