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

In Anki 24.11+, the add-on should use the easy days configuration from the deck options. #489

Open
user1823 opened this issue Nov 10, 2024 · 6 comments · Fixed by #492
Open
Labels
enhancement New feature or request

Comments

@user1823
Copy link
Contributor

The add-on and Anki have their own Easy Days settings, which can be confusing if the user sets different Easy Days in the add-on and in Anki.

So, in Anki 24.11+, the add-on should not have its own settings for Easy Days. It should use the setting in the Deck Options.

@user1823 user1823 added the enhancement New feature or request label Nov 10, 2024
@L-M-Sherlock
Copy link
Member

Unfortunately, the easy days feature of Anki is preset-level, but the one of FSRS Helper is collection-level. So the configurations of them are incompatible.

@user1823
Copy link
Contributor Author

Assuming that the add-on also worked on a preset-level basis, would it be possible to implement this?

In other words, do we need to make any changes in the Anki before this becomes possible?

I am asking this because we can make changes in the add-on any time but if some changes are needed in Anki, we need to do them soon.

@L-M-Sherlock
Copy link
Member

Assuming that the add-on also worked on a preset-level basis, would it be possible to implement this?

It's possible in theory. But it's very complex. I have to refactor the module of load balance:

def set_load_balance(self, did_query=None):
self.enable_load_balance = True
true_due = "CASE WHEN odid==0 THEN due ELSE odue END"
self.due_cnt_per_day = defaultdict(
int,
{
day: cnt
for day, cnt in mw.col.db.all(
f"""SELECT {true_due}, count()
FROM cards
WHERE type = 2
AND queue != -1
{did_query if did_query is not None else ""}
GROUP BY {true_due}"""
)
},
)
self.due_today = sum(
due_cnt
for due, due_cnt in self.due_cnt_per_day.items()
if due <= mw.col.sched.today
)
self.reviewed_today = mw.col.db.scalar(
f"""SELECT count(distinct cid)
FROM revlog
WHERE ease > 0
AND (type < 3 OR factor != 0)
AND id/1000 >= {mw.col.sched.day_cutoff - 86400}"""
)

possible_intervals = list(range(min_ivl, max_ivl + 1))
review_cnts = []
for i in possible_intervals:
check_due = last_review + i
if check_due > self.today:
review_cnts.append(self.due_cnt_per_day[check_due])
else:
review_cnts.append(self.due_today + self.reviewed_today)

due_before = card.odue if card.odid else card.due
card = update_card_due_ivl(card, new_ivl)
due_after = card.odue if card.odid else card.due
if fsrs.enable_load_balance:
fsrs.due_cnt_per_day[due_before] -= 1
fsrs.due_cnt_per_day[due_after] += 1
if due_before <= fsrs.today and due_after > fsrs.today:
fsrs.due_today -= 1
if due_before > fsrs.today and due_after <= fsrs.today:
fsrs.due_today += 1

The due_cnt_per_day is global in current implementation. I need to refactor it to preset-level. However, I cannot fetch preset id directly from the database via SQL.

@user1823
Copy link
Contributor Author

However, I cannot fetch preset id directly from the database via SQL.

So, does that require a change in Anki? If so, we may need to do it before the release.

@L-M-Sherlock
Copy link
Member

Maybe it doesn't need any changes in Anki. I have an idea, but need time to implement.

@user1823
Copy link
Contributor Author

If no changes are required in Anki, don't feel any pressure. Take your time.

@L-M-Sherlock L-M-Sherlock linked a pull request Nov 12, 2024 that will close this issue
@L-M-Sherlock L-M-Sherlock reopened this Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants