Skip to content

Commit

Permalink
fix: moves-master backfill
Browse files Browse the repository at this point in the history
  • Loading branch information
aleortega committed Oct 4, 2024
1 parent de550f2 commit dc304ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/src/logic/backfills/moves-master-backfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ function validateMovesMasterBackfillData(data: BackfillData): boolean {
return (
Number.isInteger(data.progress.usedEmotesCount) &&
Array.isArray(data.progress.achievedTier) &&
data.progress.achievedTier.every((tier) => Number.isInteger(tier.steps) && Number.isInteger(tier.completedAt)) &&
data.progress.achievedTier.every(
(tier) => Number.isInteger(tier.steps) || (!isNaN(Number(tier.steps)) && Number.isInteger(tier.completedAt))
) &&
Number.isInteger(data.progress.lastEmoteTriggeredAt) &&
data.progress.lastEmoteTriggeredAt > 0
)
Expand Down Expand Up @@ -46,7 +48,7 @@ export function mergeMovesMasterProgress(

try {
backfillData.progress.achievedTier.forEach((tier) => {
const achievedTier = badge.tiers?.find((badgeTier) => badgeTier.criteria.steps === tier.steps)
const achievedTier = badge.tiers?.find((badgeTier) => badgeTier.criteria.steps === Number(tier.steps))

if (!achievedTier) {
throw new Error('tierId received is invalid, breaking backfill')
Expand Down

0 comments on commit dc304ac

Please sign in to comment.