fix: Implement dynamic age calculation for aircraft tracking #37
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: olemd/skyview#37
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/aircraft-age-calculation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes issue #3 where aircraft age field was consistently showing 0 seconds instead of the actual time since last update.
Root Cause Analysis
Backend Issue: The
MarshalJSON
function was copying the unsetAge
field instead of calculating it dynamically.Frontend Issue: Age values only updated when new WebSocket data arrived, so aircraft without recent transmissions never showed increasing age.
Changes Made
Backend (
internal/merger/merger.go
)Age: a.Age,
toAge: time.Since(a.LastUpdate).Seconds(),
merger_test.go
to verify age calculation works correctlyFrontend (JavaScript)
calculateAge()
utility methods to bothaircraft-manager.js
andui-manager.js
${this.calculateAge(aircraft).toFixed(1)}s
${this.calculateAge(aircraft).toFixed(0)}s
app.js
that refresh displays every secondupdateOpenPopupAges()
function to update open aircraft popups in real-timeKey Benefits
✅ Accurate Age Display: Shows actual seconds since aircraft's last transmission
✅ Real-time Updates: Age increases every second in the UI, even without new aircraft data
✅ No Server Load: Client-side calculation means no additional WebSocket traffic
✅ Immediate Response: Age updates instantly in both table and popup displays
✅ Proper Data Quality: Users can now identify which aircraft have stale vs. recent data
Testing
Closes #3
🤖 Generated with Claude Code