Skip to content

Commit

Permalink
fix(bonuses): match bonuses amount to achievements count
Browse files Browse the repository at this point in the history
9teen90nine committed Sep 3, 2024

Verified

This commit was signed with the committer’s verified signature.
erikmd Erik Martin-Dorel
1 parent 2f44d0f commit 8616cf9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/achievementMethods.ts
Original file line number Diff line number Diff line change
@@ -58,15 +58,18 @@ export const achievementMethods = {
Sentry.captureException(`No tech admin with id ${config.techAdminId} from config`);
return achievement;
}

const bonuses = achievement.bonusForAchievementRule.bonusesPerCrewAchievement * amount;

await prisma.$transaction([
prisma.user.update({
where: { id: data.userId },
data: { bonusPoints: { increment: achievement.bonusForAchievementRule.bonusesPerCrewAchievement } },
data: { bonusPoints: { increment: bonuses } },
}),
prisma.bonusHistory.create({
data: {
action: 'ADD',
amount: achievement.bonusForAchievementRule.bonusesPerCrewAchievement,
amount: bonuses,
targetUserId: data.userId,
actingUserId: techAdmin.id,
description: achievement.bonusForAchievementRule.description,

0 comments on commit 8616cf9

Please sign in to comment.