Fix issue #21 and add aircraft position tracking indicators

- Fix Debian package upgrade issue by separating upgrade vs remove behavior in prerm script
- Add aircraft position tracking statistics in merger GetStatistics() method
- Update frontend to display position tracking indicators in both header and stats view
- Format Go code to maintain consistency

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-08-31 11:25:42 +02:00
commit 66a995b4d0
8 changed files with 124 additions and 74 deletions

View file

@ -795,10 +795,13 @@ func (m *Merger) GetSources() []*Source {
//
// The statistics include:
// - total_aircraft: Current number of tracked aircraft
// - aircraft_with_position: Number of aircraft with valid position data
// - aircraft_without_position: Number of aircraft without position data
// - total_messages: Sum of all messages processed
// - active_sources: Number of currently connected sources
// - aircraft_by_sources: Distribution of aircraft by number of tracking sources
//
// The position statistics help assess data quality and tracking effectiveness.
// The aircraft_by_sources map shows data quality - aircraft tracked by
// multiple sources generally have better position accuracy and reliability.
//
@ -810,11 +813,22 @@ func (m *Merger) GetStatistics() map[string]interface{} {
totalMessages := int64(0)
activeSources := 0
aircraftBySources := make(map[int]int) // Count by number of sources
aircraftWithPosition := 0
aircraftWithoutPosition := 0
for _, state := range m.aircraft {
totalMessages += state.TotalMessages
numSources := len(state.Sources)
aircraftBySources[numSources]++
// Check if aircraft has valid position data
if state.Aircraft.PositionValid &&
state.Aircraft.Latitude != 0.0 &&
state.Aircraft.Longitude != 0.0 {
aircraftWithPosition++
} else {
aircraftWithoutPosition++
}
}
for _, src := range m.sources {
@ -824,10 +838,12 @@ func (m *Merger) GetStatistics() map[string]interface{} {
}
return map[string]interface{}{
"total_aircraft": len(m.aircraft),
"total_messages": totalMessages,
"active_sources": activeSources,
"aircraft_by_sources": aircraftBySources,
"total_aircraft": len(m.aircraft),
"aircraft_with_position": aircraftWithPosition,
"aircraft_without_position": aircraftWithoutPosition,
"total_messages": totalMessages,
"active_sources": activeSources,
"aircraft_by_sources": aircraftBySources,
}
}