From dba91471db83e7f2b74796d63e8717b9abfb4650 Mon Sep 17 00:00:00 2001 From: Kevin Joiner <10265309+KevinJoiner@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:00:08 -0400 Subject: [PATCH] Add schema check for soc --- pkg/vss/convert/vehicle-convert-funcs_gen.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/vss/convert/vehicle-convert-funcs_gen.go b/pkg/vss/convert/vehicle-convert-funcs_gen.go index 1af23ba..da165c6 100644 --- a/pkg/vss/convert/vehicle-convert-funcs_gen.go +++ b/pkg/vss/convert/vehicle-convert-funcs_gen.go @@ -297,8 +297,12 @@ func ToPowertrainTractionBatteryGrossCapacity0(originalDoc []byte, val float64) // Vehicle.Powertrain.TractionBattery.StateOfCharge.Current: Physical state of charge of the high voltage battery, relative to net capacity. This is not necessarily the state of charge being displayed to the customer. // Unit: 'percent' Min: '0' Max: '100.0' func ToPowertrainTractionBatteryStateOfChargeCurrent0(originalDoc []byte, val float64) (float64, error) { - // soc comes in as a value between 0 and 1, convert to percentage. - return val * 100, nil + version := GetSchemaVersion(originalDoc) + if semver.Compare(StatusV1, version) == 0 || semver.Compare(StatusV1Converted, version) == 0 { + // soc comes in as a value between 0 and 1, convert to percentage. + return val * 100, nil + } + return val, nil } // ToPowertrainTransmissionTravelledDistance0 converts data from field 'odometer' of type float64 to 'Vehicle.Powertrain.Transmission.TravelledDistance' of type float64.