Skip to content

Commit

Permalink
fix: show max 10 certs and 10 hour requests on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
rutmanz committed Oct 9, 2024
1 parent 4d4b5cc commit 6ce06f5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/slack/blocks/app_home.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ export async function getAppHome(user_id: string) {
const pending_requests = await getPendingHourSubmissionData()
const pending_certs = await prisma.memberCertRequest.findMany({ where: { state: 'pending' }, include: { Member: true, Cert: true, Requester: true } })

homeTab.blocks(Blocks.Header().text('Pending Hour Submissions'))
homeTab.blocks(Blocks.Header().text('Pending Hour Submissions (' + pending_requests.length + ')'))
if (pending_requests.length > 0) {
homeTab.blocks(pending_requests.flatMap((req) => [...getHourSubmissionBlocks(req), Blocks.Divider()]))
homeTab.blocks(pending_requests.slice(0, 10).flatMap((req) => [...getHourSubmissionBlocks(req), Blocks.Divider()]))
} else {
homeTab.blocks(Blocks.Section().text('None'))
homeTab.blocks(Blocks.Divider())
}
homeTab.blocks(Blocks.Header().text('Pending Certifications'))
homeTab.blocks(Blocks.Header().text('Pending Certifications (' + pending_certs.length + ')'))
if (pending_certs.length > 0) {
homeTab.blocks(pending_certs.flatMap((req) => [...getCertRequestBlocks(req).blocks, Blocks.Divider()]))
homeTab.blocks(pending_certs.slice(0, 10).flatMap((req) => [...getCertRequestBlocks(req).blocks, Blocks.Divider()]))
} else {
homeTab.blocks(Blocks.Section().text('None'))
homeTab.blocks(Blocks.Divider())
Expand Down

0 comments on commit 6ce06f5

Please sign in to comment.