[object Object]

← back to AbramsOS

savings: home dashboard tile + honest merchant-savings leads

a121be0d301e94ea681f8fac69e8405e072faa5d · 2026-07-13 00:21:17 -0700 · Steve

- home: 'Savings ideas' stat tile (open count + est $ total) linking to /savings
- seeded 3 real verifiable savings mechanisms (Amazon Subscribe & Save, camelcamelcamel price alerts, Costco coupon book) — real URLs, no fabricated codes

Files touched

Diff

commit a121be0d301e94ea681f8fac69e8405e072faa5d
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon Jul 13 00:21:17 2026 -0700

    savings: home dashboard tile + honest merchant-savings leads
    
    - home: 'Savings ideas' stat tile (open count + est $ total) linking to /savings
    - seeded 3 real verifiable savings mechanisms (Amazon Subscribe & Save, camelcamelcamel price alerts, Costco coupon book) — real URLs, no fabricated codes
---
 routes/home.js | 9 ++++++++-
 views/home.ejs | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/routes/home.js b/routes/home.js
index fb663a8..0b63334 100644
--- a/routes/home.js
+++ b/routes/home.js
@@ -5,7 +5,7 @@ const router = express.Router();
 const DEV_USER_ID = 'user_steve';
 
 router.get('/', async (_req, res) => {
-  const [connectorCount, purchaseCount, lastSync, recent] = await Promise.all([
+  const [connectorCount, purchaseCount, lastSync, recent, savings] = await Promise.all([
     db.query(`SELECT count(*)::int AS n FROM connector_account WHERE user_id = $1`, [DEV_USER_ID]),
     db.query(`SELECT count(*)::int AS n FROM purchase WHERE user_id = $1`, [DEV_USER_ID]),
     db.query(`SELECT max(last_sync_at) AS t FROM connector_account WHERE user_id = $1`, [DEV_USER_ID]),
@@ -14,12 +14,19 @@ router.get('/', async (_req, res) => {
          FROM purchase WHERE user_id = $1 ORDER BY purchase_date DESC LIMIT 6`,
       [DEV_USER_ID]
     ),
+    db.query(
+      `SELECT count(*)::int AS n, COALESCE(sum(est_savings),0) AS total
+         FROM savings_suggestion WHERE user_id = $1 AND status IN ('new','saved')`,
+      [DEV_USER_ID]
+    ),
   ]);
   res.render('home', {
     connectorCount: connectorCount.rows[0].n,
     purchaseCount: purchaseCount.rows[0].n,
     lastSync: lastSync.rows[0].t,
     recent: recent.rows,
+    savingsCount: savings.rows[0].n,
+    savingsTotal: Number(savings.rows[0].total) || 0,
   });
 });
 
diff --git a/views/home.ejs b/views/home.ejs
index a572e07..db0f3b1 100644
--- a/views/home.ejs
+++ b/views/home.ejs
@@ -18,6 +18,10 @@
     <div class="num"><%= lastSync ? new Date(lastSync).toLocaleString() : 'never' %></div>
     <div class="label">Last sync</div>
   </div>
+  <a class="stat glass" href="/savings" style="text-decoration:none">
+    <div class="num"><%= (typeof savingsCount !== 'undefined' ? savingsCount : 0) %><% if (typeof savingsTotal !== 'undefined' && savingsTotal > 0) { %> <span class="subtle" style="font-size:.5em">~$<%= savingsTotal.toFixed(0) %></span><% } %></div>
+    <div class="label">Savings ideas →</div>
+  </a>
 </section>
 
 <% if (connectorCount === 0) { %>

← db2fd48 savings: life-optimizer module — cheaper/better substitutes  ·  back to AbramsOS  ·  docs: life-optimizer roadmap (overnight) 3e9efe5 →