mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-08-28 03:04:25 +00:00
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:
+14
-4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user