Skip to content

Commit

Permalink
Merge pull request #343 from bettersg/feat/add-absolute-thresholds
Browse files Browse the repository at this point in the history
added absolute thresholds
  • Loading branch information
sarge1989 authored Jun 12, 2024
2 parents 41456b0 + ee50bbc commit c6771af
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions functions/src/definitions/common/parameters/thresholds.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"endVote": 0.5,
"endVoteSus": 0.2,
"endVoteUnsure": 0.8,
"endVoteAbsolute": 10,
"endVoteSusAbsolute": 4,
"endVoteUnsureAbsolute": 16,
"startVote": 1,
"isSpam": 0.5,
"isLegitimate": 0.5,
Expand Down
18 changes: 15 additions & 3 deletions functions/src/definitions/eventHandlers/onVoteRequestUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,23 @@ const onVoteRequestUpdateV2 = onDocumentUpdated(
unsureCount > thresholds.isUnsure * validResponsesCount
const isAssessed =
(isUnsure &&
validResponsesCount > thresholds.endVoteUnsure * factCheckerCount) ||
validResponsesCount >
Math.min(
thresholds.endVoteUnsure * factCheckerCount,
thresholds.endVoteSusAbsolute //16
)) ||
(!isUnsure &&
validResponsesCount > thresholds.endVote * factCheckerCount) ||
validResponsesCount >
Math.min(
thresholds.endVote * factCheckerCount,
thresholds.endVoteAbsolute //10
)) ||
(isSus &&
validResponsesCount > thresholds.endVoteSus * factCheckerCount)
validResponsesCount >
Math.min(
thresholds.endVoteSus * factCheckerCount,
thresholds.endVoteSusAbsolute //4
))

//set primaryCategory
let primaryCategory
Expand Down

0 comments on commit c6771af

Please sign in to comment.