Skip to content

Commit

Permalink
fix: Rework the way last value is calculated
Browse files Browse the repository at this point in the history
  • Loading branch information
tzebrowski committed Nov 6, 2024
1 parent 9a4f97c commit 1cf7722
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,17 @@ internal class InMemoryDragRacingRegistry : DragRacingResultRegistry {
val speed = metric.speed

if (time <= 0L) {
Log.v(LOG_KEY, "Invalid value")
Log.v(LOG_KEY, "Invalid value=$time")
} else {


entry.last = if (entry.last == VALUE_NOT_SET || entry.current == VALUE_NOT_SET) {
time
} else {
entry.current
if ( entry.current != VALUE_NOT_SET) {
entry.last = entry.current
Prefs.updateString(id.last, entry.last.toString())
}

entry.current = time
entry.currentSpeed = speed


Prefs.updateString(id.last, entry.last.toString())

if (entry.best > time || entry.best == VALUE_NOT_SET) {

entry.best = metric.time
Expand Down

0 comments on commit 1cf7722

Please sign in to comment.