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

remember new card position after cards are introduced #1658

Closed
dae opened this issue Feb 11, 2022 · 1 comment
Closed

remember new card position after cards are introduced #1658

dae opened this issue Feb 11, 2022 · 1 comment

Comments

@dae
Copy link
Member

dae commented Feb 11, 2022

Anki currently forgets the position/due# of a new card when it is reviewed for the first time. It would be nice to correct this, but as there is no column on the cards table set aside for this purpose, we need to decide where to store it, and consider the implications for syncing and compatibility with other clients/older Anki releases.

The simplest option would be to store the value in JSON in the data column of the cards table. It is not currently used, and was originally added with such extensibility purposes in mind. It is sent as a string in the current syncing protocol, and clients should be leaving it alone currently, so doing it this way should minimize compatibility issues.

JSON is not ideal for performance reasons though, as code like the deck list screen relies on a table scan of it performing relatively well, and the larger the table grows, the longer it takes to scan. We'd need to use something like the following in JSON:

{"pos":123456}

which is 14 bytes. If we instead were storing the value in a protobuf message in a blob, it would be 4 bytes.

But using protobuf at the moment will require changes to the sync protocol, and will likely break older clients if we start storing blob values in the cards table. So I think our only options at the moment are to hold off (which we've been doing for a long time already), or to go with JSON for now, and push a move to protobuf down the line (at the very least, we'll want to wait until AnkiDroid has caught up to the latest rslib).

@dae
Copy link
Member Author

dae commented Mar 16, 2022

Closed by #1677 and #1714

@dae dae closed this as completed Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant