Sort & reorder is not working

I have a small deck with 8 new cards (4 notes that are forward/reverse). See next image.

I moved these to a test deck from another deck that has thousands of notes.

The notes have an extra field called “priority” that was created as the browser sort field. I manually entered 3 digit string integers, and can sort the notes by this string. See next image.

I select these in sorted order and reposition. See next image.

I then show the cards again (rather than the notes) and sort by their Due column (their “new” integer). See next image.

For some reason, the sort order is not respected—the card with string “003” is neither the top nor the bottom of the sorted list.

Am I not understanding something about cards, decks, and sorting? Note that this test deck does only have these cards that you see in the screen shots.

I am quite keen to get this working because I have thousands of cards, and this scheme will allow me to implement a priority queue for new cards in a way that would work very well for me.

Thanks for any help

-Eric

I’ve never had any issues with Repositioning the New-queue by sort order.

As far as why it is happening, I suspect it has something to do with your particular Sort field. It’s numerical, but sorted more alphabetically (although the leading zeros shouldn’t be necessary) – so any odd hidden character that gets in there could confuse things.

It’s also unusual that your search filter is blank. Did you re-run your search between the Reposition and re-sorting the rows by a different column? That can refresh the display, to make sure what you’re seeing is accurate.

Things you can try to fix/avoid it –

  • Run Tools > Check Database. Whenever anything is unusual in your New-queue – that’s the first thing to do.
  • Sort the rows in forward order before the Reposition, instead of reverse order.
  • Don’t switch to “Notes” mode before running Reposition. [I don’t know why that would make a difference, but I’m actually a bit curious to see if it does.]
  • If you have any add-ons, start Anki in safe mode before running the Reposition.

I don’t see any problem at all. You selected the cards, pressed Ctrl+A or whatever. Otherwise, we need to somehow show the range we’ll be working on.

Hi Danika,

Thanks for your quick reply. The leading 0’s are just so alphabetic sorting works correctly.

I think this might be related to sorting by note vs card.

I did a new test in which I created a brand new deck with 3 new cards, which I added in an unsorted order: “002”, “001”, and “003”. Here is one such card:

The deck has the following initial state

I sort the cards by the sort field so 003 is on top, hit cmd-a to select all, and reposition:

That order is correct. If I undo, reverse the sort order, and reposition, the order is correctly in the opposite order with 001 coming first (screenshot omitted).

Now return to the initial state (two pictures above, labeled “inital state”). Turn on “notes” mode and sort:

Then I select all (cmd-a), reposition, and return to “cards” mode. The order of the “Due” column is repositioned according to the order I added the cards to the deck (002, 001, 003), not the sort order of the rows in my view.

So, it seems that the problem happens when I sort by notes rather than cards.

Next I returned to the previous test deck that I used for my initial post, and the behavior is the same—there was nothing special about those existing cards or deck. Sorting by note and repositioning does not reposition by sort order—it repositions by the existing card “Due” order.

Question: Is it safe for me to reposition after sorting in this priority order? My fear is that this will split apart the basic/reversed card pairs, which I need to keep paired so they are pulled correctly each day.

Repositioning by card seems safe so far. In the deck below you can see multiple cards with priority “000”. The “Due” values are out of order because I’ve sorted by priority and multiple cards have the same priority:

Now I select all and reposition:

The “Due” values of the 000 cards looks worrisome, but if you inspect them, the two cards that are labeled “New 3” (for example) are a correct basic/reversed pair.

So, this seems safe. But its just one test. Do you know if its possible for these operations to split apart basic/reversed card pairs?

Best,

-Eric

I can set a custom order for new cards, even if they’re paired (related).
This will display cards 0, 1, and 2.
Where 0 and 2 are the same note, but different cards. That is, they’re a pair, since they have the same note ID. You can check this in the card details.
So, display order is one concept, and a pair (or maybe more) is another.

My point was that I don’t think think you need them for that. For column sorting, it’s always worked fine for me without that.

Reposition is a Cards action, but I’m not sure why it’s behaving so differently in Notes mode than in Cards mode. Thank you for testing that though! This is what we’ll want to see if anyone else can reproduce.

Yes, that will work. When you Reposition all the cards from a note in the same action, they will always move together to the same New-queue position, even if they had different positions before. [If you wanted to get them to separate New-queue positions, you would have to deliberately Reposition them in separate actions.]

Thanks Danika. I implemented this in conjunction with my iPhone Anki app and it worked. I was able to bump the priority on a note on my iPhone, sync, reorder on desktop, and resync to find that the new order is correctly updated on my iPhone.

Also, I verified that you are correct: leading 0’s are not required. If the field is purely numeric, it gets interpreted as a numerical value (e.g., “09” and “9” get sorted next to each other; 1 and 10 are not close).

One small nit came up: to sort in the desktop browser, I must change the sort field to my newly created “priority” field, but if I sync that way to my iPhone app then the browser view on my app no longer shows the card contents (the sort field would normally be the card contents). I use that browser while studying, so it seems that i need to revert the sort-by-priority change after I reorder the cards. This makes AnkiWeb believe that I am totally replacing my db, but I don’t think there are any negative consequences. Please let me know if you see an issue.

Followed your exact steps on AnkiDroid and it worked correctly:

You can change the browser appearance instead.

Zorn, I’m not able to select “Front” as a display option in the iPhone app:

I can select “Answer”, but that’s not really what I need to see. And, I don’t think the iPhone app allows further customization than what these menus provide.

You want either “Question” or “Answer”. You can change what these display in the browser appearance screen which can be found in the template editor on AnkiDroid and Anki Desktop.

If AnkiMobile doesn’t have that, then try to edit the appearance on Anki Desktop and sync. Maybe it’ll work.

Ok. Yes using “question” does it. This gives me a complete solution in which the “priority” field can remain as the sort field!

I guess Anki prefers to let users implement things like this themselves via the basic tools. That said, a priority queue seems super useful for language learning where one encounters words and might want to bump their priority the more often they are encountered.

Thanks so much

You’re welcome.

There are addons such as morphman which automatically reposition new cards for optimal learning order. I personally don’t bother with that.

I suddenly have many buried cards after I reordered. Could this happen if I reorder from 0?

When I did the re-order, I was careful to select only new cards that were not suspended or buried. But, given how long it took to sort everything out, I forgot to set the reorder start digit from 0 to something larger than the Due number of the largest buried card. Now it feels like I’ve got to fix something, but I don’t know what is broken.

Reposition can’t bury cards, so I suspect that’s not what happened. The most obvious next step is Edit > Undo – it will tell you what steps you’re undoing, so keep going until you get to “Undo Reposition.” Then you can start over with it.

Unfortunately I’ve lost the undo history. Some of the buried cards are the back sides of the cards I studied this morning. If I leave those buried, will the card pulling logic unbury them tomorrow?

The other many cards were already-studied cards that I know well, so I simply unburied them.

Those would have been buried when you studied their siblings this morning. Yes, all buried cards are unburied when the next day starts.