From 5c328ab0a4328a7d1073757fa0a283eb17ce18ff Mon Sep 17 00:00:00 2001 From: Yehoshua Sandler Date: Sun, 4 May 2025 11:14:14 -0500 Subject: [PATCH] fix: outbound hold count --- src/components/Feed/UserFeed.tsx | 8 +++++++- src/components/Manage/CheckedOutBooks.tsx | 2 +- src/components/Manage/HoldRequests.tsx | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/Feed/UserFeed.tsx b/src/components/Feed/UserFeed.tsx index ff6c302..e3c346a 100644 --- a/src/components/Feed/UserFeed.tsx +++ b/src/components/Feed/UserFeed.tsx @@ -97,7 +97,13 @@ const UserFeed = async (props: Props) => { }, })) as PaginatedDocs - const totalHoldNotifications = repos?.docs.flatMap((r) => r.holdRequests?.docs).length || 0 + const totalHoldNotifications = + repos?.docs + .flatMap((r) => r.holdRequests?.docs) + .filter((r) => { + const repo = r as HoldRequest + return !repo.isRejected && !repo.isCheckedOut + }).length || 0 const outBoundLoanCount = loanedOutBooks?.totalDocs || 0 const currentlyHoldingCount = currentlyHeldBooks?.totalDocs || 0 diff --git a/src/components/Manage/CheckedOutBooks.tsx b/src/components/Manage/CheckedOutBooks.tsx index 4e6cbf3..bae385c 100644 --- a/src/components/Manage/CheckedOutBooks.tsx +++ b/src/components/Manage/CheckedOutBooks.tsx @@ -161,7 +161,7 @@ const CheckedOutBooks = (props: Props) => { return (
-

Inbound Checked Out Books

+

Outbound Checked Out Books

diff --git a/src/components/Manage/HoldRequests.tsx b/src/components/Manage/HoldRequests.tsx index 59b65e9..d7091e9 100644 --- a/src/components/Manage/HoldRequests.tsx +++ b/src/components/Manage/HoldRequests.tsx @@ -155,7 +155,7 @@ const HoldRequestNotifications = (props: Props) => { return (
-

Inbound Hold Requests

+

Outbound Hold Requests

{!!totalHoldNotifications && ( {totalHoldNotifications} Unaddressed )}