[object Object]

← back to Filemaker Mcp

auto-save: 2026-07-28T17:01:56 (1 files) — scripts/post-mtd-correction.mjs

57f06a3e9721d108470a1a4d10277736c2b299a3 · 2026-07-28 17:02:02 -0700 · Steve Abrams

Files touched

Diff

commit 57f06a3e9721d108470a1a4d10277736c2b299a3
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue Jul 28 17:02:02 2026 -0700

    auto-save: 2026-07-28T17:01:56 (1 files) — scripts/post-mtd-correction.mjs
---
 scripts/post-mtd-correction.mjs | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/scripts/post-mtd-correction.mjs b/scripts/post-mtd-correction.mjs
new file mode 100644
index 0000000..5799c54
--- /dev/null
+++ b/scripts/post-mtd-correction.mjs
@@ -0,0 +1,27 @@
+// One-shot: post the July 2026 MTD correction to Slack #new-order.
+// The 4:30 report on 2026-07-28 undercounted MTD (query-window bug, now fixed
+// in sales-summary.mjs). This re-states the corrected figure in-channel.
+//   node scripts/post-mtd-correction.mjs
+import { loadEnv } from '../lib/fm-script-helpers.js';
+
+loadEnv(import.meta.url);
+
+const token = process.env.SLACK_BOT_TOKEN;
+const CHANNEL = process.env.SALES_SUMMARY_CHANNEL || 'C06D9C2PG1K'; // #new-order
+if (!token) throw new Error('SLACK_BOT_TOKEN not set.');
+
+const text =
+  '*🔧 Correction — Month-to-date (July 2026)*\n\n' +
+  'The earlier 4:30 summary undercounted month-to-date due to a query-window bug ' +
+  '(it summed only the trailing 10 days, dropping Jul 1–17). Corrected figures:\n\n' +
+  '📈 *Month-to-date — booked (July 2026):* ~80 orders · $26,526.23~  →  *250 orders · $67,373.33*\n\n' +
+  '_Bug fixed; tomorrow’s automatic 4:30 report will be correct. Last-24h and quote figures were unaffected._';
+
+const res = await fetch('https://slack.com/api/chat.postMessage', {
+  method: 'POST',
+  headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json; charset=utf-8' },
+  body: JSON.stringify({ channel: CHANNEL, text, unfurl_links: false }),
+});
+const j = await res.json();
+if (!j.ok) throw new Error(`Slack post failed: ${j.error}`);
+console.log(`✓ Correction posted to ${CHANNEL} (ts ${j.ts})`);

← dafc8b0 Fix DW Reports Bot MTD undercount: query from month-start, n  ·  back to Filemaker Mcp  ·  Harden sales-summary against silent fetch truncation 073ebdd →