Skip to content

bug: speed (cards/min) calculation inaccurate after bulk card reset #31

Description

@rbstrachan

When cards are reset, the revlog generates entries for those cards with a duration of 0. The current SQL query in the add-on counts these resets as reviewed cards causing the 'cards/min' calculation to be higher than the true value. This problem is exaggerated for large decks — resetting 233k cards caused the add-on to claim I had a review speed of 3,447,525 cards/min.

Steps to Reproduce

  1. Import deck
  2. Go to browser, select all cards, reset
  3. Check cards/min and time remaining stats

Expected Behaviour

The add-on should only calculate speed based on cards that were actually reviewed, ignoring logs generated by administrative actions like resetting.

Suggested Fix

In the renderStats function, the SQL query can be modified to exclude logs with a time value of 0.

# adding 'and time > 0' to filter out resets
cards, thetime = self.mw.col.db.first("""select count(), sum(time)/1000 from revlog where id > ? and time > 0""", query_time_param * 1000)

Versions

Anki Version: 25.09.2
Add-on Version: v2.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions