feat(platform): include service status in vehicle resolution
This commit is contained in:
@@ -601,6 +601,9 @@ func buildVehicleIdentityResolution(keyword string, vehicles []VehicleRow) Vehic
|
||||
if !strings.EqualFold(vehicle.VIN, identity.VIN) {
|
||||
continue
|
||||
}
|
||||
if result.ServiceStatus == nil && vehicle.ServiceStatus != nil {
|
||||
result.ServiceStatus = vehicle.ServiceStatus
|
||||
}
|
||||
if vehicle.Online {
|
||||
result.Online = true
|
||||
}
|
||||
@@ -619,5 +622,26 @@ func buildVehicleIdentityResolution(keyword string, vehicles []VehicleRow) Vehic
|
||||
result.Protocols = appendIfMissing(result.Protocols, vehicle.Protocol)
|
||||
}
|
||||
sort.Strings(result.Protocols)
|
||||
if result.ServiceStatus == nil {
|
||||
result.ServiceStatus = buildVehicleCoverageServiceStatus(VehicleCoverageRow{
|
||||
VIN: result.VIN,
|
||||
Plate: result.Plate,
|
||||
Phone: result.Phone,
|
||||
OEM: result.OEM,
|
||||
Protocols: result.Protocols,
|
||||
SourceCount: len(result.Protocols),
|
||||
OnlineSourceCount: boolToInt(result.Online),
|
||||
Online: result.Online,
|
||||
LastSeen: result.LastSeen,
|
||||
BindingStatus: "bound",
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func boolToInt(value bool) int {
|
||||
if value {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user