From 47dd323a51765e13935c986c74738821366995b4 Mon Sep 17 00:00:00 2001 From: Rahul Keerthi Date: Tue, 20 Oct 2020 18:36:06 +0100 Subject: [PATCH] block limit on debriefs --- app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index 278a889..23b4a5f 100644 --- a/app.js +++ b/app.js @@ -773,7 +773,7 @@ app.action("batch_selection", async ({ ack, payload, body, client }) => { selectedResponse += ` Unfortunately, we could only find the following ${lastFiveDebriefs.length} debriefs!` } if (lastFiveDebriefs.length > 0) { - const blocks = lastFiveDebriefs.flatMap(debrief => debrief.blocks) + const blocks = lastFiveDebriefs.splice(0, 5).flatMap(debrief => debrief.blocks) blocks.forEach(block => { if (block.text && block.text.text) { if (/Hi Team/.test(block.text.text) || /DebriefBot over and/.test(block.text.text) || /next session's lead/.test(block.text.text)) { @@ -791,6 +791,8 @@ app.action("batch_selection", async ({ ack, payload, body, client }) => { } catch (error) { console.error(error) } + console.log("Number of blocks:") + console.log(debriefBlocks.length) app_home_basic_block = JSON.stringify({ type: "home", blocks: debriefBlocks,