Skip to content

Instantly share code, notes, and snippets.

@Stanislav-Lapata
Created June 14, 2016 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stanislav-Lapata/1a99804c97b11ca17ffab228789415aa to your computer and use it in GitHub Desktop.
Save Stanislav-Lapata/1a99804c97b11ca17ffab228789415aa to your computer and use it in GitHub Desktop.
def update_obd_device_odometer(trip)
if trip.summary.odo && trip.summary.odo > 0
vehicle = Vehicle.find_by(id: trip.vehicle.id)
if vehicle.obd_device_odometer && vehicle.obd_device_odometer < trip.summary.odo
vehicle.update_attributes(obd_device_odometer: trip.summary.odo)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment