From b0e543957ce404580a45ac2e121481f07da07234 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Mon, 10 Oct 2022 14:24:57 -0600 Subject: [PATCH] Backfill all users badges --- functions/src/scripts/backfill-badges.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/functions/src/scripts/backfill-badges.ts b/functions/src/scripts/backfill-badges.ts index 5218ed7c..648467cf 100644 --- a/functions/src/scripts/backfill-badges.ts +++ b/functions/src/scripts/backfill-badges.ts @@ -1,7 +1,7 @@ import * as admin from 'firebase-admin' import { initAdmin } from './script-init' -import { getUser, getValues } from '../utils' +import { getAllUsers, getValues } from '../utils' import { Contract } from 'common/contract' import { MarketCreatorBadge, @@ -10,18 +10,17 @@ import { streakerBadgeRarityThresholds, } from 'common/badge' import { User } from 'common/user' -import { filterDefined } from 'common/util/array' initAdmin() const firestore = admin.firestore() async function main() { - // const users = await getAllUsers() - // const users = filterDefined([await getUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')]) - const users = filterDefined([await getUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')]) + const users = await getAllUsers() + // const users = filterDefined([await getUser('6hHpzvRG0pMq8PNJs7RZj2qlZGn2')]) // dev ian + // const users = filterDefined([await getUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')]) // prod ian await Promise.all( users.map(async (user) => { - console.log('Added achievements to user', user.id) + // console.log('Added achievements to user', user.id) if (!user.id) return if (user.achievements === undefined) { await firestore.collection('users').doc(user.id).update({