← back to Rentv 2026
newsSig: document that money amounts normalize to MILLIONS (k÷1000, m×1, b×1000) + guard against a wrong 'fix' — a defect-hunt agent misread k/=1000 as a bug (it's correct at a millions base; *=1000 would equate $100k with $100B and break news dedup). Comment-only, no behavior change
27c93660366487db00476094e4c6b87d48d68a1c · 2026-08-05 18:26:52 -0700 · Steve
Files touched
Diff
commit 27c93660366487db00476094e4c6b87d48d68a1c
Author: Steve <steve@designerwallcoverings.com>
Date: Wed Aug 5 18:26:52 2026 -0700
newsSig: document that money amounts normalize to MILLIONS (k÷1000, m×1, b×1000) + guard against a wrong 'fix' — a defect-hunt agent misread k/=1000 as a bug (it's correct at a millions base; *=1000 would equate $100k with $100B and break news dedup). Comment-only, no behavior change
---
server.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/server.js b/server.js
index 269bab56..b51fa0b4 100644
--- a/server.js
+++ b/server.js
@@ -1108,7 +1108,10 @@ function newsSig(title) {
const t = String(title || '').toLowerCase();
const money = t.match(/\$\s?([\d.]+)\s?(billion|bil|b|million|mil|m|k)?/);
let m = '';
- if (money && money[1]) { let n = parseFloat(money[1]); const u = money[2] || ''; if (/^b/.test(u)) n *= 1000; if (u === 'k') n /= 1000; if (!isNaN(n)) m = (Math.round(n * 10) / 10).toString(); } // keep 1 decimal so $47.5M ≠ $48.2M
+ // Normalize EVERY amount to the same base unit = MILLIONS: billion ×1000, million ×1, k(thousand) ÷1000.
+ // So $100k→0.1, $100M→100, $100B→100000 — all on one scale. Do NOT "fix" `u==='k'` to *=1000: that
+ // would equate $100k with $100B and break news dedup. (kept 1 decimal so $47.5M ≠ $48.2M.)
+ if (money && money[1]) { let n = parseFloat(money[1]); const u = money[2] || ''; if (/^b/.test(u)) n *= 1000; if (u === 'k') n /= 1000; if (!isNaN(n)) m = (Math.round(n * 10) / 10).toString(); }
const units = ((t.match(/([\d,]{2,})\s?-?\s?unit/) || [])[1] || '').replace(/,/g, '');
// distinctive tokens = property names, cities, unusual terms (brokers/generics already removed)
const toks = new Set(t.replace(/[^a-z0-9 ]/g, ' ').split(/\s+/).filter(w => w.length >= 4 && !NEWS_STOP.has(w)));
← f84bac8c auto-save: 2026-08-05T18:14:36 (7 files) — data/deals-regist
·
back to Rentv 2026
·
auto-save: 2026-08-05T18:44:47 (7 files) — data/deals-regist c014ea30 →