Inconsistent number of reviews when clicking `optimize`

image

Another confusing toast:

image

image

Why are they different? I think the first one should be Only 0 review was found.

Can you provide an example apkg which demonstrates the inconsistency?

The ‘insufficient history to perform this operation’ is triggered in other cases such as when there are no learning steps in the review history (get_optimal_retention_parameters())

It could reproduce the second issue. When I search preset:all prop:ivl>100, there is zero card queried.

For the first issue, I guess the computeWeightsProgressString isn’t emptied.

fsrs-rs’s smooth_and_fill may return FSRSError::NotEnoughData, which turns into the 500 error.

I will update the progress code to clear out the old text at the start of an operation.

But the number of reviews is zero, which is less than 1000 reviews. The less than 1000 warning should pop up before smooth_and_fill.

JS error /_anki/pages/deck-options.js:1 Uncaught (in promise) Error: 500: Insufficient review history to perform this operation.
1704685029.276 POST /_anki/computeFsrsWeights
[rslib/src/scheduler/fsrs/weights.rs:83] &search = Group(
    [
        Search(
            Preset(
                "all",
            ),
        ),
        And,
        Search(
            Property {
                operator: ">",
                kind: Interval(
                    100,
                ),
            },
        ),
    ],
)
[rslib/src/search/mod.rs:235] &sql = "select c.id from cards c where (c.did in (1544629910163,1572797501025,1701922603144) and ivl > 100)"
[rslib/src/scheduler/fsrs/weights.rs:42] revlogs.len() = 0
[rslib/src/scheduler/fsrs/weights.rs:45] fsrs_items = 0
Traceback (most recent call last):
  File "/Users/jarrettye/Codes/anki/qt/aqt/mediasrv.py", line 630, in wrapped
    if data := handler():
  File "/Users/jarrettye/Codes/anki/qt/aqt/mediasrv.py", line 611, in <lambda>
    return lambda: getattr(aqt.mw.col._backend, f"{endpoint}_raw")(request.data)
  File "/Users/jarrettye/Codes/anki/out/pylib/anki/_backend_generated.py", line 931, in compute_fsrs_weights_raw
    return self._run_command(11, 27, message)
  File "/Users/jarrettye/Codes/anki/pylib/anki/_backend.py", line 166, in _run_command
    raise backend_exception_to_pylib(err)
anki.errors.InvalidInput: Insufficient review history to perform this operation.

[rslib/src/scheduler/fsrs/weights.rs:59] guard.current() = 0
[rslib/src/scheduler/fsrs/weights.rs:59] guard.total() = 0

I’ve pushed a change that will do the count check at the start.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.