open-spaced-repetition/fsrs4anki-helper

[Enhancement] Allow auto-disperse after sync when auto-reschedule is disabled

Closed this issue · 9 comments

An alpha release of AnkiDroid is soon (likely within 2-3 days) going to support native FSRS.

After that release, people won't be needing auto-reschedule after sync that much. But auto-disperse would still be required.

So, I think that it is the time to modify auto-disperse such that it works after sync even if auto-reschedule is disabled.

It's pretty easy. Just rewrite this code:

def auto_reschedule(local_rids: List[int]):
if len(local_rids) == 0:
return
config = Config()
config.load()
if not config.auto_reschedule_after_sync:
return
local_rid_string = ",".join([str(local_rid) for local_rid in local_rids])
# exclude entries where ivl == lastIvl: they indicate a dynamic deck without rescheduling
remote_reviewed_cids = [
cid
for cid in mw.col.db.list(
f"SELECT DISTINCT cid FROM revlog WHERE id NOT IN ({local_rid_string}) and ivl != lastIvl"
)
]
remote_reviewed_cid_string = ",".join([str(cid) for cid in remote_reviewed_cids])
rescheduled_nids = [
nid
for nid in mw.col.db.list(
f"""SELECT DISTINCT nid
FROM cards
WHERE id IN ({remote_reviewed_cid_string})
"""
)
]
filtered_nid_string = ",".join([str(nid) for nid in rescheduled_nids])
fut = reschedule(
None,
recent=False,
filter_flag=True,
filtered_cids=set(remote_reviewed_cids),
filtered_nid_string=filtered_nid_string,
)
# wait for reschedule to finish
return fut.result()

I will update the add-on after the alpha release.

I plan to separate the auto reschedule after sync and auto disperse after sync. What do you think about that?

That's what I suggested.

A small suggestion: If both are enabled, finding the cards with reviews should happen only once (just like it currently happens).

Something is wrong.

In my config, auto-reschedule is disabled.
image

But, the add-on menu shows that auto-reschedule is enabled. Also, the tooltip after sync says "x cards rescheduled …"
image

I have restarted Anki twice but that also didn't help.

I can't reproduce this bug. Could you reinstall the add-on?

I can't reproduce this bug. Could you reinstall the add-on?

I was probably because of the meta.json file which was not present in the above zip and, thus, was retained in my add-on folder.

I have tested the patch and it seems to work well.

However, the tooltip is not reliably displayed. That is, after sync, the tooltip is sometimes not displayed. This issue is not specific to this patch, and I have been experiencing it since many days (probably started after updating to 23.10).

However, the tooltip is not reliably displayed. That is, after sync, the tooltip is sometimes not displayed. This issue is not specific to this patch, and I have been experiencing it since many days (probably started after updating to 23.10).

OK. I will merge at first, and open a new issue to track it.