Modified FetchInterval to look for consecutive chapters #1006
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a manga has 8 or more chapters, but the 10 most recent chapters aren't consecutive (e.g. using a source that only allows free users to download the 5 most recent chapters and the first 5 chapters), Tachiyomi will average the time between the most recent chapter and the 10th most recent available chapter.
This means that if there are missing chapters in-between, the smart update interval could be wildly off. If a manga has 105 chapters, with the most recent chapter on day 1470 (biweekly) but only the first and last 5 chapters are available, Tachi will say that the next chapter releases in ( (1470 - 0) / 10) = 147 days. This change makes Tachi only look at the most recent chapters with consecutive chapter numbers, so in that hypothetical it would expect the next chapter in ((1470 - 1400) / 5) = 14 days.
There's definitely more improvements possible here, this is just a quick hacky change. Ideally it would use more complex math, and currently this change wouldn't work if Tachiyomi can't determine actual chapter numbers (I'm not sure what cases this would happen in).
Other potential improvement: calculate expected next update using the update frequency and the last chapter upload date, rather than the date that the manga was last checked in Tachiyomi.
Before change:
After change: