filter map reports from portnum-counts

This commit is contained in:
Anton Roslund 2025-04-07 21:41:06 +02:00
parent cdcefee641
commit 4c6bccc058

View file

@ -240,12 +240,17 @@ router.get('/portnum-counts', async (req, res) => {
created_at: { gte: startTime }, created_at: { gte: startTime },
...(Number.isInteger(nodeId) ? { from: nodeId } : {}) ...(Number.isInteger(nodeId) ? { from: nodeId } : {})
}, },
select: { protobuf: true } select: { protobuf: true, mqtt_topic: true }
}); });
const counts = {}; const counts = {};
for (const row of messages) { for (const row of messages) {
try { try {
// We want to filter out any map reports.
if (row.mqtt_topic && row.mqtt_topic.endsWith("/map/")) {
continue;
}
const envelope = ServiceEnvelope.decode(row.protobuf); const envelope = ServiceEnvelope.decode(row.protobuf);
const packet = envelope.packet; const packet = envelope.packet;