Default deck card order changes when downloaded through ankiweb

Hello everyone,

Several users have been reporting issues with this deck I uploaded:

ankiweb. net/shared/info/610839770

I generate the deck with Python’s genanki library. It’s supposed to follow a level structure, and when I load the apkg that I generate directly in Anki it does seem to work without any tweaks, I get level 1 cards, then level 2 etc… So I couldn’t reproduce the issue:

However today it occurred to me that I should probably try with the version downloaded from ankiweb (until now I always assumed the decks would be identical) and, lo and behold, that version does start at level 4 for some reason:

I have no idea what causes this behaviour. Is it a genanki quirk? Am I not setting something correctly? The “Sort Field” in the deck is the kanji character, but that doesn’t actually explain the discrepancy here because clearly the order used is not the kanji lexical order either.

Here’s the “raw” deck as I generate it, before it gets processed by ankiweb:

e.pcloud. link/publink/show?code=XZyo7cZm5sfSlOtVvFuf4L4JKuNXuGxwhdX

And here’s my Python script generating the deck:

gitlab. com/flio/wkanki/-/blob/c009cb17f65661f4eae70fb39737a6c4aab55849/wkanki.py#L2286-2315

Thank you for your help!

PS: sorry for the obfuscated links, Discourse won’t let me post otherwise…

I haven’t downloaded your files to try them myself, but if the file you’re generating doesn’t have New-queue positions already, the cards will probably be positioned in order of your note-created timestamps. Have you looked at the “Due” column to compare those position numbers?

The other thing you should consider is the Options you’re using in your collection, and any Options you’ve included in the deck. Regardless of the New-queue positions, a different New card gather order can change what cards are introduced first.

[You can more effectively “obfuscate” your links just by putting them between backticks, in code blocks. That makes it easier for folks to simply copy-paste them.]