mortii / anki-morphs

A MorphMan fork rebuilt from the ground up with a focus on simplicity, performance, and a codebase with minimal technical debt.
https://mortii.github.io/anki-morphs/
GNU Affero General Public License v3.0
61 stars 9 forks source link

Cards are re-synced after recalc #30

Closed mortii closed 12 months ago

mortii commented 1 year ago

as discussed in #29

mortii commented 1 year ago

The problem still persists when using 'mw.col.sched.reposition_new_cards()' instead of 'mw.col.update_cards()'

If a card was not actually modified it has to be removed from the 'modified_cards' list.

Vilhelm-Ian commented 1 year ago

thanks mortii. Do you wish to do that or shall I

Vilhelm-Ian commented 1 year ago

Because when I reposition a card from the anki browser and adjust other cards it dosen't lead to long sync

This ^ is fake news. I just tried to manually reposition and shift from anki. And it does lead to a longer sync. I think there is nothing we can do about it.

We can try to change only the due value of cards with one unknown morph?

mortii commented 1 year ago

@Vilhelm-Ian sorry I haven't replied, I didn't receive a notification for some reason...

I have a fix, I just need to make it cleaner.

This ^ is fake news. I just tried to manually reposition and shift from anki. And it does lead to a longer sync. I think there is nothing we can do about it.

Yeah, I've tested reposition, the biggest problem with it is that it inserts the cards into the queue in the order of the card ids, not the due, so it is unusable in this case.

In the 'lean card now' it is inserted into position 0 which is normally not occupied, so maybe that is why there is no displacement and long syncs.

We can try to change only the due value of cards with one unknown morph?

Setting properties of cards or notes, even if you don't use the respective 'mw.col.update_...', seems to result in a sync difference for some reason. If that is actually the case then that is a horrible hidden side-effect imo. In my fix I use a mock-card class that stores the values temporarily, and only in the end do I change the card's properties if they are different.

Hopefully I can get it finished tomorrow.

mortii commented 1 year ago

The good news:

Setting properties of cards or notes, even if you don't use the respective 'mw.col.update_...', seems to result in a sync difference for some reason. If that is actually the case then that is a horrible hidden side-effect imo.

This turned out to be false. I was mislead by these: https://github.com/mortii/anki-morphs/blob/6be5bc11202a40cea0a11cee09d5a2e29d709a28/ankimorphs/recalc.py#L244-L247 They always create 3 sync changes.

The bad news: There is a slight inconsistency in calculating the difficulty of cards which has a ripple effect.

card: 1691325167089 due: 501146 card: 1691325167089 due: 501147

This only seems to happen on the first recalc after opening anki, which probably means the first round of caching is slightly off.

Vilhelm-Ian commented 1 year ago

awsome that you made progress

mortii commented 1 year ago

Recalc has become somewhat slower after this fix, 40K japanese cards takes ~17 seconds instead of ~14 seconds.

Another problem I found is that notes that use highlighting might take more than one recalc to be fully up to date. That's because highlighting uses tags to determine learning status of morphs, but tags are only added at the end of a recalc.That should probably be fixed at some point.

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.