From 055a2d1bfebd6f0b8e1747e5ca3fecc38ff6c77b Mon Sep 17 00:00:00 2001 From: Schaka <2223171+Schaka@users.noreply.github.com> Date: Sat, 16 Nov 2024 12:21:34 +0100 Subject: [PATCH] [Jellystat] Correct age calculation if an item was re-downloaded after having been watched --- .../com/github/schaka/janitorr/servarr/LibraryItem.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/github/schaka/janitorr/servarr/LibraryItem.kt b/src/main/kotlin/com/github/schaka/janitorr/servarr/LibraryItem.kt index 3ff20fd..07406d2 100644 --- a/src/main/kotlin/com/github/schaka/janitorr/servarr/LibraryItem.kt +++ b/src/main/kotlin/com/github/schaka/janitorr/servarr/LibraryItem.kt @@ -27,8 +27,16 @@ data class LibraryItem( val tags: List = listOf(), // extra files that may be provided and or copied over for leaving soon - like subtitles val extraFiles: MutableList = mutableListOf(), + + ) { val historyAge: LocalDateTime - get() = lastSeen ?: importedDate + get(): LocalDateTime { + if (lastSeen?.isAfter(importedDate) == true) { + return lastSeen!! + } + return importedDate + } + } \ No newline at end of file