Skip to content

Commit

Permalink
Add optional badgeId to fix-levels
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Aug 2, 2024
1 parent b072649 commit 9941194
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/cli/src/commands/badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const subcommand = program.command("badges");
subcommand
.command("rescan")
.description("Rescan a badge to fill in missing XP.")
.argument("[badgeId]")
.argument("<badgeId>")
.action(async (badgeId, options) => {
const [badge] = await db
.select()
Expand All @@ -25,11 +25,13 @@ subcommand
subcommand
.command("fix-levels")
.description("Recalculate all levels.")
.action(async (options) => {
.argument("[badgeId]")
.action(async (badgeId, options) => {
const awardQuery = await db.query.badgeAwards.findMany({
with: {
badge: true,
},
where: badgeId ? eq(badgeAwards.badgeId, badgeId) : undefined,
});

for (const award of awardQuery) {
Expand Down

0 comments on commit 9941194

Please sign in to comment.