Need at least 3 unique bettors for market maker badge

This commit is contained in:
Ian Philips 2022-10-06 21:23:45 -04:00
parent 4fbb6568c0
commit abd9a5dd24
2 changed files with 8 additions and 1 deletions

View File

@ -53,7 +53,7 @@ const calculateProvenCorrectBadgeRarity = (badge: ProvenCorrectBadge) => {
return 1 return 1
} }
export const streakerBadgeRarityThresholds = [1, 50, 125] export const streakerBadgeRarityThresholds = [1, 50, 200]
const calculateStreakerBadgeRarity = (badge: StreakerBadge) => { const calculateStreakerBadgeRarity = (badge: StreakerBadge) => {
const { totalBettingStreak } = badge.data const { totalBettingStreak } = badge.data
const thresholdArray = streakerBadgeRarityThresholds const thresholdArray = streakerBadgeRarityThresholds
@ -67,6 +67,7 @@ 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,6 +14,7 @@ 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
@ -48,6 +49,11 @@ async function handleMarketCreatorBadgeAward(contractCreator: User) {
firestore firestore
.collection(`contracts`) .collection(`contracts`)
.where('creatorId', '==', contractCreator.id) .where('creatorId', '==', contractCreator.id)
.where(
'uniqueBettorCount',
'>=',
MINIMUM_UNIQUE_BETTORS_FOR_MARKET_MAKER_BADGE
)
) )
if (contracts.length in marketMakerBadgeRarityThresholds) { if (contracts.length in marketMakerBadgeRarityThresholds) {
const badge = { const badge = {