Only backfill unfilled users' badges
This commit is contained in:
parent
f26ba1c4a2
commit
867cdf2496
|
@ -20,17 +20,18 @@ async function main() {
|
||||||
// const users = filterDefined([await getUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')]) // prod ian
|
// const users = filterDefined([await getUser('AJwLWoo3xue32XIiAVrL5SyR1WB2')]) // prod ian
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
users.map(async (user) => {
|
users.map(async (user) => {
|
||||||
// console.log('Added achievements to user', user.id)
|
|
||||||
if (!user.id) return
|
if (!user.id) return
|
||||||
|
// Only backfill users without achievements
|
||||||
if (user.achievements === undefined) {
|
if (user.achievements === undefined) {
|
||||||
await firestore.collection('users').doc(user.id).update({
|
await firestore.collection('users').doc(user.id).update({
|
||||||
achievements: {},
|
achievements: {},
|
||||||
})
|
})
|
||||||
user.achievements = {}
|
user.achievements = {}
|
||||||
|
user.achievements = await awardMarketCreatorBadges(user)
|
||||||
|
user.achievements = await awardBettingStreakBadges(user)
|
||||||
|
console.log('Added achievements to user', user.id)
|
||||||
|
// going to ignore backfilling the proven correct badges for now
|
||||||
}
|
}
|
||||||
user.achievements = await awardMarketCreatorBadges(user)
|
|
||||||
user.achievements = await awardBettingStreakBadges(user)
|
|
||||||
// going to ignore backfilling the proven correct badges for now
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user