Skip to content

Commit

Permalink
fix(credits): fix probe finding for price
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjeneer committed Jun 8, 2023
1 parent 6ce458b commit cde0d62
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/requests/scanService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const requestScan = async (scanRequest: CreateScanRequest): Promise<ScanR
const userCredits = await getUserCredits(scanRequest.user_id)

const availableProbes = getAvailableProbes()
const sumOfCreditsToUse = scanRequest.probes?.reduce((sum, probe) => sum + availableProbes[probe.name]?.price, 0)
const sumOfCreditsToUse = scanRequest.probes?.reduce((sum, probe) => sum + availableProbes.find((p) => p.name === probe.name)?.price, 0)
if (userCredits < sumOfCreditsToUse) {
throw new UserHasNotEnoughCredits(scanRequest.user_id)
}
Expand Down

0 comments on commit cde0d62

Please sign in to comment.