Skip to content

Commit

Permalink
fix untracked record with zero duration always shown when cutoff is d…
Browse files Browse the repository at this point in the history
…isabled
  • Loading branch information
Razeeman committed Oct 13, 2024
1 parent df4162f commit 5b2aa67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.example.util.simpletimetracker.core.interactor

import com.example.util.simpletimetracker.core.mapper.TimeMapper
import com.example.util.simpletimetracker.domain.UNTRACKED_ITEM_ID
import com.example.util.simpletimetracker.domain.extension.dropMillis
import com.example.util.simpletimetracker.domain.interactor.GetUntrackedRecordsInteractor
import com.example.util.simpletimetracker.domain.interactor.PrefsInteractor
import com.example.util.simpletimetracker.domain.interactor.RecordInteractor
Expand Down Expand Up @@ -29,7 +30,7 @@ class GetUntrackedRecordsInteractorImpl @Inject constructor(
val minStart = recordInteractor.getNext(0)?.timeStarted ?: return emptyList()
// Bound end range of calculation to current time,
// to not show untracked time in the future
val maxEnd = System.currentTimeMillis()
val maxEnd = System.currentTimeMillis().dropMillis()

// If range is all records - calculate from first records to current time.
val actualRange = if (range.timeStarted == 0L && range.timeEnded == 0L) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.example.util.simpletimetracker.domain.model

import com.example.util.simpletimetracker.domain.extension.dropMillis

data class RunningRecord(
val id: Long,
override val timeStarted: Long,
Expand All @@ -8,5 +10,5 @@ data class RunningRecord(
) : RecordBase {

override val typeIds: List<Long> = listOf(id)
override val timeEnded: Long get() = System.currentTimeMillis()
override val timeEnded: Long get() = System.currentTimeMillis().dropMillis()
}

0 comments on commit 5b2aa67

Please sign in to comment.