fix: address remaining review findings
- Fix detail.html to use assigned_technician_name (not .assigned_technician?.full_name) - Remove double error toast in submitNote() catch block - Replace wasteful API calls in CEO dashboard with units+data approach - Remove QR Code option from reported_via dropdown (excluded per scope)
This commit is contained in:
@@ -218,15 +218,22 @@
|
||||
});
|
||||
this.charts.monthlyMax = Math.max(...this.charts.monthlyTrend.map(m => m.count), 1);
|
||||
|
||||
// By property
|
||||
// By property — load units once and compute from ticket data
|
||||
const propData = { east: 0, west: 0 };
|
||||
all.forEach(t => { /* would need unit join — estimate from ticket IDs */ });
|
||||
try {
|
||||
const east = await app().apiGet('/api/tickets?property=East&page_size=1');
|
||||
const west = await app().apiGet('/api/tickets?property=West&page_size=1');
|
||||
propData.east = east?.total || 0;
|
||||
propData.west = west?.total || 0;
|
||||
} catch (e) { /* api may not support property filter directly */ }
|
||||
const units = await app().apiGet('/api/tickets/units');
|
||||
if (units && units.length > 0) {
|
||||
const unitPropertyMap = {};
|
||||
units.forEach(u => { unitPropertyMap[u.id] = u.property; });
|
||||
all.forEach(t => {
|
||||
if (t.unit_id && unitPropertyMap[t.unit_id]) {
|
||||
const p = unitPropertyMap[t.unit_id].toLowerCase();
|
||||
if (p === 'east') propData.east++;
|
||||
else if (p === 'west') propData.west++;
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e) { console.error('Property stats error', e); }
|
||||
this.charts.byProperty = { east: propData.east, west: propData.west, max: Math.max(propData.east, propData.west, 1) };
|
||||
|
||||
// By category — use categories endpoint
|
||||
|
||||
Reference in New Issue
Block a user