Don't include n/a resolutions in market creator badge

This commit is contained in:
Ian Philips 2022-10-10 08:25:14 -06:00
parent 005a918c6d
commit d6e7ecfe1f
2 changed files with 1 additions and 7 deletions

View File

@ -67,7 +67,6 @@ const calculateStreakerBadgeRarity = (badge: StreakerBadge) => {
return 1 return 1
} }
export const MINIMUM_UNIQUE_BETTORS_FOR_MARKET_MAKER_BADGE = 3
export const marketMakerBadgeRarityThresholds = [1, 50, 200] export const marketMakerBadgeRarityThresholds = [1, 50, 200]
const calculateMarketMakerBadgeRarity = (badge: MarketCreatorBadge) => { const calculateMarketMakerBadgeRarity = (badge: MarketCreatorBadge) => {
const { totalContractsCreated } = badge.data const { totalContractsCreated } = badge.data

View File

@ -14,7 +14,6 @@ import * as admin from 'firebase-admin'
import { import {
MarketCreatorBadge, MarketCreatorBadge,
marketMakerBadgeRarityThresholds, marketMakerBadgeRarityThresholds,
MINIMUM_UNIQUE_BETTORS_FOR_MARKET_MAKER_BADGE,
} from '../../common/badge' } from '../../common/badge'
export const onCreateContract = functions export const onCreateContract = functions
@ -49,11 +48,7 @@ async function handleMarketCreatorBadgeAward(contractCreator: User) {
firestore firestore
.collection(`contracts`) .collection(`contracts`)
.where('creatorId', '==', contractCreator.id) .where('creatorId', '==', contractCreator.id)
.where( .where('resolution', '!=', 'CANCEL')
'uniqueBettorCount',
'>=',
MINIMUM_UNIQUE_BETTORS_FOR_MARKET_MAKER_BADGE
)
) )
if (contracts.length in marketMakerBadgeRarityThresholds) { if (contracts.length in marketMakerBadgeRarityThresholds) {
const badge = { const badge = {