mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 06:17:57 +01:00 
			
		
		
		
	Use smaller window to calculate fetch interval if there's less total chapters
This is sort of a workaround for sources that tend to only give you the first few and most recent few chapters, which would have been 28 day intervals before due to the big gap in the middle.
This commit is contained in:
		| @@ -46,6 +46,8 @@ class FetchInterval( | ||||
|     } | ||||
|  | ||||
|     internal fun calculateInterval(chapters: List<Chapter>, zone: ZoneId): Int { | ||||
|         val chapterWindow = if (chapters.size <= 8) 3 else 10 | ||||
|  | ||||
|         val uploadDates = chapters.asSequence() | ||||
|             .filter { it.dateUpload > 0L } | ||||
|             .sortedByDescending { it.dateUpload } | ||||
| @@ -55,7 +57,7 @@ class FetchInterval( | ||||
|                     .atStartOfDay() | ||||
|             } | ||||
|             .distinct() | ||||
|             .take(10) | ||||
|             .take(chapterWindow) | ||||
|             .toList() | ||||
|  | ||||
|         val fetchDates = chapters.asSequence() | ||||
| @@ -66,7 +68,7 @@ class FetchInterval( | ||||
|                     .atStartOfDay() | ||||
|             } | ||||
|             .distinct() | ||||
|             .take(10) | ||||
|             .take(chapterWindow) | ||||
|             .toList() | ||||
|  | ||||
|         val interval = when { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user