Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EnhancedTracker not auto binding when adding manga to library #1298

Merged
merged 1 commit into from
Oct 13, 2024

Conversation

brewkunz
Copy link
Contributor

@brewkunz brewkunz commented Oct 5, 2024

This PR is an attempt to fix the issue #306.

Tracking used to be enabled by default when adding an item to the library, which is not the case anymore.
This fix tries to bind with all logged In enhanced trackers upon adding an item to the library.

I think there still is an issue with the track being saved with a last_read_chapter value of 0.0, but the problem seems to lie in the SyncChapterProgressWithTrack and is not introduced by this fix.

.filterIsInstance<EnhancedTracker>()
.filter { it.accept(source) }
.forEach { service ->
try {
service.match(manga)?.let { track ->
track.manga_id = manga.id
(service as Tracker).bind(track)
insertTrack.await(track.toDomainTrack()!!)
insertTrack.await(track.toDomainTrack(idRequired = false)!!)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now needed since the track might not have an id yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old implementation didn't need this (which actually did auto bind) either so should be fine? unless it was a issue during testing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was indeed an issue during my tests. If the item you add to the library has no exisiting track with the tracker, the track has no id yet and toDomainTrack throws an exception.
It seems like this method allows for inserting and updating, but when you are inserting you have to set this parameter to false.

@AntsyLich
Copy link
Member

Good job trying to fix your own issue

@AntsyLich
Copy link
Member

I think there still is an issue with the track being saved with a last_read_chapter value of 0.0, but the problem seems to lie in the SyncChapterProgressWithTrack and is not introduced by this fix.

Should be a separate PR

@brewkunz brewkunz force-pushed the fix/306_tracking-not-enabled branch from 38376e0 to 5df78cd Compare October 7, 2024 13:44
@AntsyLich AntsyLich changed the title Fix #306 Enable tracking with enhanced trackers when adding to the library. Fix EnhancedTracker not auto binding when adding manga to library Oct 10, 2024
@AntsyLich AntsyLich merged commit 3ed8a91 into mihonapp:main Oct 13, 2024
1 check passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants