feat(SystemStatistics): add system jumps and kills statistics with toggle functionality

This commit is contained in:
2025-09-14 22:37:00 +02:00
parent 41f7d3157f
commit 8575155f4b
9 changed files with 354 additions and 0 deletions

33
app.go
View File

@@ -186,6 +186,39 @@ func (a *App) ToggleCharacterWaypointEnabled(characterID int64) error {
return a.ssi.ToggleCharacterWaypointEnabled(characterID)
}
// GetSystemJumps fetches system jump statistics from ESI
func (a *App) GetSystemJumps() ([]SystemJumps, error) {
fmt.Printf("🔍 App.GetSystemJumps() called - this should ONLY happen when toggle is ON!\n")
if a.ssi == nil {
return nil, errors.New("ESI not initialised")
}
ctx, cancel := context.WithTimeout(a.ctx, 15*time.Second)
defer cancel()
return a.ssi.GetSystemJumps(ctx)
}
// GetSystemKills fetches system kill statistics from ESI
func (a *App) GetSystemKills() ([]SystemKills, error) {
fmt.Printf("🔍 App.GetSystemKills() called - this should ONLY happen when toggle is ON!\n")
if a.ssi == nil {
return nil, errors.New("ESI not initialised")
}
ctx, cancel := context.WithTimeout(a.ctx, 15*time.Second)
defer cancel()
return a.ssi.GetSystemKills(ctx)
}
// ResolveSystemIDByName resolves a system name to its ID
func (a *App) ResolveSystemIDByName(systemName string) (int64, error) {
fmt.Printf("🔍 App.ResolveSystemIDByName() called for system: %s\n", systemName)
if a.ssi == nil {
return 0, errors.New("ESI not initialised")
}
ctx, cancel := context.WithTimeout(a.ctx, 5*time.Second)
defer cancel()
return a.ssi.ResolveSystemIDByName(ctx, systemName)
}
// SystemRegion holds system + region names from local DB
type SystemRegion struct {
System string `json:"system"`