Refactor GeoIP data handling to ensure consistent coordinate propagation
- Updated the logic in the geo enrichment process to fill in geographic coordinates even when they are 0.0, enhancing map visualization. - Modified the GeoIP lookup function to always return latitude and longitude, improving the accuracy of location data for the UI. - Improved comments for clarity regarding the importance of geographic data in the mapping context.
This commit is contained in:
@@ -28,7 +28,9 @@ func EnrichUniqueIPsGeo(rows []UniqueIPsRow, g *geoip.Service) {
|
||||
s := res.CityName
|
||||
rows[i].IPs[j].CityName = &s
|
||||
}
|
||||
if res.Latitude != 0 || res.Longitude != 0 {
|
||||
// Заполняем координаты если GeoIP нашёл геоданные (страна/город),
|
||||
// даже если координаты оказались 0.0 (иначе карта может быть пустой).
|
||||
if res.CountryCode != "" || res.CountryName != "" || res.CityName != "" {
|
||||
lat := res.Latitude
|
||||
lon := res.Longitude
|
||||
rows[i].IPs[j].Latitude = &lat
|
||||
|
||||
Reference in New Issue
Block a user