diff --git a/decoder/pokemon.go b/decoder/pokemon.go index 8b87f444..d434c696 100644 --- a/decoder/pokemon.go +++ b/decoder/pokemon.go @@ -388,7 +388,7 @@ func savePokemonRecordAsAtTime(ctx context.Context, db db.DbDetails, pokemon *Po updatePokemonLookup(pokemon, changePvpField, pvpResults) areas := MatchStatsGeofence(pokemon.Lat, pokemon.Lon) - createPokemonWebhooks(oldPokemon, pokemon, areas) + createPokemonWebhooks(ctx, db, oldPokemon, pokemon, areas) updatePokemonStats(oldPokemon, pokemon, areas) updatePokemonNests(oldPokemon, pokemon) @@ -399,7 +399,7 @@ func savePokemonRecordAsAtTime(ctx context.Context, db db.DbDetails, pokemon *Po } } -func createPokemonWebhooks(old *Pokemon, new *Pokemon, areas []geo.AreaName) { +func createPokemonWebhooks(ctx context.Context, db db.DbDetails, old *Pokemon, new *Pokemon, areas []geo.AreaName) { //nullString := func (v null.Int) interface{} { // if !v.Valid { // return "null" @@ -425,6 +425,18 @@ func createPokemonWebhooks(old *Pokemon, new *Pokemon, areas []geo.AreaName) { return new.PokestopId.ValueOrZero() } }(), + "pokestop_name": func() *string { + if !new.PokestopId.Valid { + return nil + } else { + pokestop, _ := GetPokestopRecord(ctx, db, new.PokestopId.String) + name := "Unknown" + if pokestop != nil { + name = pokestop.Name.ValueOrZero() + } + return &name + } + }(), "encounter_id": new.Id, "pokemon_id": new.PokemonId, "latitude": new.Lat,