[object Object]

← back to Nationalrealestate

usreal brokers: honest count (show 'first 200 of N' not full total next to a truncated grid) on residential+commercial desks + firm-detail honors active asset_class filter (Cody gate fixes, TK-10590)

5a16e24f89817c7c8c8d811175f800f2d3b1440e · 2026-08-15 08:13:29 -0700 · Steve Abrams

Files touched

Diff

commit 5a16e24f89817c7c8c8d811175f800f2d3b1440e
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sat Aug 15 08:13:29 2026 -0700

    usreal brokers: honest count (show 'first 200 of N' not full total next to a truncated grid) on residential+commercial desks + firm-detail honors active asset_class filter (Cody gate fixes, TK-10590)
---
 public/brokers.html             | 2 +-
 public/commercial-brokers.html  | 5 +++--
 public/residential-brokers.html | 7 +++++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/public/brokers.html b/public/brokers.html
index 2d6b3a2..c21d63a 100644
--- a/public/brokers.html
+++ b/public/brokers.html
@@ -270,7 +270,7 @@ async function toggleFirmDetail(row, el) {
   if (!row.firm_id) return; // firm-less agent → agent-contact block only
   try {
     let d = firmCache.get(row.firm_id);
-    if (!d) { d = await fetch('/api/firm/' + row.firm_id).then(r => r.json()); firmCache.set(row.firm_id, d); }
+    if (!d) { const acq = S.assetClass ? ('?asset_class=' + S.assetClass) : ''; d = await fetch('/api/firm/' + row.firm_id + acq).then(r => r.json()); firmCache.set(row.firm_id, d); }
     target.innerHTML = agentBlock + (d.error ? `<div class="usre-fd fd-muted">${esc(d.error)}</div>` : firmDetailHtml(d));
   } catch (e) {
     target.innerHTML = agentBlock + '<div class="usre-fd fd-muted">failed to load firm detail</div>';
diff --git a/public/commercial-brokers.html b/public/commercial-brokers.html
index d027874..578b879 100644
--- a/public/commercial-brokers.html
+++ b/public/commercial-brokers.html
@@ -67,10 +67,11 @@
 const $=s=>document.querySelector(s);
 const state={tab:'firms',city:'LOS ANGELES',q:''};
 async function j(u){const r=await fetch(u);return r.json();}
+function setCount(rows,total,noun){$('#count').textContent = (rows<total) ? ('showing first '+rows.toLocaleString()+' of '+total.toLocaleString()+' '+noun+' — refine by city/search') : (total.toLocaleString()+' '+noun);}
 function params(){const p=new URLSearchParams({state:'CA',limit:200});if(state.city)p.set('city',state.city);if(state.q)p.set('q',state.q);return p;}
 async function loadFirms(){
   const d=await j('/api/firms?'+params());
-  $('#count').textContent=d.total.toLocaleString()+' firms';
+  setCount((d.rows||[]).length, d.total||0, 'firms');
   $('#grid').innerHTML=d.rows.map(f=>`<div class="card firm" data-id="${f.id}" data-name="${(f.name||'').replace(/"/g,'&quot;')}">
     <div class="n">${f.name||'—'}</div>
     <div class="m"><span class="agents">${f.agent_count||0} agents</span><span>${f.hq_city||''}</span>${f.license_no?`<span>DRE ${f.license_no}</span>`:''}</div>
@@ -89,7 +90,7 @@ async function toggleRoster(c){
 }
 async function loadBrokers(){
   const d=await j('/api/brokers?'+params());
-  $('#count').textContent=d.total.toLocaleString()+' brokers';
+  setCount((d.rows||[]).length, d.total||0, 'brokers');
   $('#grid').innerHTML=d.rows.map(b=>`<div class="card">
     <div class="n">${b.name||'—'}</div>
     <div class="m"><span class="lt">${b.license_type||''}</span><span>${b.firm_name||'—'}</span><span>${b.city||''}</span>${b.license_no?`<span>DRE ${b.license_no}</span>`:''}</div></div>`).join('');
diff --git a/public/residential-brokers.html b/public/residential-brokers.html
index 77ec503..40525c5 100644
--- a/public/residential-brokers.html
+++ b/public/residential-brokers.html
@@ -68,12 +68,15 @@
 const $=s=>document.querySelector(s);
 const state={tab:'firms',city:'LOS ANGELES',q:''};
 async function j(u){const r=await fetch(u);return r.json();}
+// Honest count: this desk pulls a capped page (limit 200). Never show the full total next to a
+// truncated card list — say "first N of TOTAL" so the number matches what's on screen (Cody gate).
+function setCount(rows,total,noun){$('#count').textContent = (rows<total) ? ('showing first '+rows.toLocaleString()+' of '+total.toLocaleString()+' '+noun+' — refine by city/search') : (total.toLocaleString()+' '+noun);}
 // Residential desk — force asset_class=residential on every registry call so this surface only ever
 // shows residential firms/agents (the mirror of RENTV forcing commercial). TK-10590.
 function params(){const p=new URLSearchParams({state:'CA',limit:200,asset_class:'residential'});if(state.city)p.set('city',state.city);if(state.q)p.set('q',state.q);return p;}
 async function loadFirms(){
   const d=await j('/api/firms?'+params());
-  $('#count').textContent=d.total.toLocaleString()+' firms';
+  setCount((d.rows||[]).length, d.total||0, 'firms');
   $('#grid').innerHTML=d.rows.map(f=>`<div class="card firm" data-id="${f.id}" data-name="${(f.name||'').replace(/"/g,'&quot;')}">
     <div class="n">${f.name||'—'}</div>
     <div class="m"><span class="agents">${f.agent_count||0} agents</span><span>${f.hq_city||''}</span>${f.license_no?`<span>DRE ${f.license_no}</span>`:''}</div>
@@ -92,7 +95,7 @@ async function toggleRoster(c){
 }
 async function loadBrokers(){
   const d=await j('/api/brokers?'+params());
-  $('#count').textContent=d.total.toLocaleString()+' agents';
+  setCount((d.rows||[]).length, d.total||0, 'agents');
   $('#grid').innerHTML=d.rows.map(b=>`<div class="card">
     <div class="n">${b.name||'—'}</div>
     <div class="m"><span class="lt">${b.license_type||''}</span><span>${b.firm_name||'—'}</span><span>${b.city||''}</span>${b.license_no?`<span>DRE ${b.license_no}</span>`:''}</div></div>`).join('');

← 6e7676c usreal: surface residential brokers — dedicated /residential  ·  back to Nationalrealestate  ·  usreal: dedupe residential+commercial broker desks into shar e61c69f →