summaryrefslogtreecommitdiffhomepage
path: root/storage.go
diff options
context:
space:
mode:
Diffstat (limited to 'storage.go')
-rw-r--r--storage.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/storage.go b/storage.go
index 75108ac..9a8b8fc 100644
--- a/storage.go
+++ b/storage.go
@@ -5,6 +5,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
+ "fmt"
"io"
"io/ioutil"
"net/http"
@@ -68,6 +69,16 @@ func (s *Storage) AddBattle(battle *Battle) error {
return errors.New("missing killmails")
}
battle.CalculateHash()
+ killmail := battle.Killmails[0]
+ details, err := GetKillmail(killmail.Id, killmail.Hash)
+ if err != nil {
+ return err
+ }
+ system, err := GetSolarSystem(details.SolarSystemId)
+ if err != nil {
+ return err
+ }
+ battle.Name = fmt.Sprintf("Battle in %s", system.Name)
data, err := json.Marshal(battle)
if err != nil {
return err