From 985ef5959ebc166a7db39d981ff13c453a05c167 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 5 Jun 2023 17:46:44 +0200 Subject: [PATCH] fixed pbs not working with funboxes --- backend/src/utils/pb.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/src/utils/pb.ts b/backend/src/utils/pb.ts index 92649c572..ee58894eb 100644 --- a/backend/src/utils/pb.ts +++ b/backend/src/utils/pb.ts @@ -1,5 +1,5 @@ import _ from "lodash"; -import FunboxesMetadata from "../constants/funbox-list"; +import FunboxList from "../constants/funbox-list"; interface CheckAndUpdatePbResult { isPb: boolean; @@ -15,9 +15,17 @@ export function canFunboxGetPb( const funbox = result.funbox; if (!funbox || funbox === "none") return true; - return funbox - .split("#") - .every((funboxName) => FunboxesMetadata[funboxName]?.canGetPb === true); + let ret = true; + const resultFunboxes = funbox.split("#"); + for (const funbox of FunboxList) { + if (resultFunboxes.includes(funbox.name)) { + if (!funbox.canGetPb) { + ret = false; + } + } + } + + return ret; } export function checkAndUpdatePb(