fix: Go server since/until filter uses observation timestamp, not first_seen

The frontend sends ISO timestamps to filter by observation time.
Go was filtering by transmission first_seen which missed packets
with recent observations but old first_seen. Now converts ISO to
unix epoch and queries the observations table directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kpa-clawbot
2026-03-27 07:53:59 -07:00
co-authored by Copilot
parent 5c68605f2c
commit dbac8e9d52
+14 -4
View File
@@ -459,12 +459,22 @@ func (db *DB) buildTransmissionWhere(q PacketQuery) ([]string, []interface{}) {
args = append(args, strings.ToLower(q.Hash))
}
if q.Since != "" {
where = append(where, "t.first_seen > ?")
args = append(args, q.Since)
if t, err := time.Parse(time.RFC3339Nano, q.Since); err == nil {
where = append(where, "t.id IN (SELECT DISTINCT transmission_id FROM observations WHERE timestamp >= ?)")
args = append(args, t.Unix())
} else {
where = append(where, "t.first_seen > ?")
args = append(args, q.Since)
}
}
if q.Until != "" {
where = append(where, "t.first_seen < ?")
args = append(args, q.Until)
if t, err := time.Parse(time.RFC3339Nano, q.Until); err == nil {
where = append(where, "t.id IN (SELECT DISTINCT transmission_id FROM observations WHERE timestamp <= ?)")
args = append(args, t.Unix())
} else {
where = append(where, "t.first_seen < ?")
args = append(args, q.Until)
}
}
if q.Node != "" {
pk := db.resolveNodePubkey(q.Node)