What's the best way to preserve my v11 edits?

Hi,

I’ve spent all of M1 and M2 accumulating thousands of personal edits in the main “text” section and the “extra” section of v11 Anking cards. I would like to transition to v12 now. What would be the best way to do this without losing my v11 edits? I recognize that a lot of the v12 changes occur in the “text” and “extra” sections, so I’m worried that protecting fields will cause me to miss the v12 changes. For instance, is there a way to mass copy + paste my current “text” and “extra” sections into the lecture notes section so that they will remain there after updating?

Thanks

Hello,

What you can do is protect the text and extra then add specific protect tags for cards that have edits. You can see how to protect specific cards only in this post: 🔐 Protecting Fields and Tags

After that, you can unprotect the Text and Extra fields in AnkiHub and do this to receive all the new changes:

Reset your local changes. To do this:

Go to browse in your Anki → at the top click on ankihub addon tab → press reset all local changes

This will restore everything to what AnkiHub has unless you have specifically protected those fields

So does that mean I have to manually go through the thousands of edited cards to protect them?

Is there no way to do my previous idea of mass copy + pasting into an irrelevant section and protecting that section:

For instance, is there a way to mass copy + paste my current “text” and “extra” sections into the lecture notes section so that they will remain there after updating?

I don’t 100% think there is a way to do that since it will also copy the clozes if you copy from the text section

You can also try sorting by “date modified” before you update to V12, then flag all those cards. Then you can specifically protect those cards only

If we ignore the text section and are only talking about the extra section which wouldn’t have clozes, then do you know of a way to mass copy paste? For some reason, sorting by “card modified” or “note modified” is not giving me the expected results.

Let me ask @abdo.nh

thanks, I look forward to any updates!

Here’s a potential solution for copying your Text and Extra fields to Lecture Notes:

  1. Take a backup just in case: Backups - Anki Manual
  2. Open the browser and select all notes in the AnKing deck (or just the notes you want to modify)
  3. Keep the browser open, open the debug console and run the following code:
import aqt

browser = aqt.dialogs.open("Browser", mw)
nids = browser.selected_notes()
notes = []
for nid in nids:
  note = mw.col.get_note(nid)
  lecture_notes = f'<h2>Text</h2>{note["Text"]}<h2>Extra</h2>{note["Extra"]}'
  note["Lecture Notes"] = lecture_notes
  notes.append(note)

mw.col.update_notes(notes)

Thanks! When I try with just a few cards, this works well. However, if I select the entire AnKing deck, I get the following output error:

>>> import aqt
... 
... browser = aqt.dialogs.open("Browser", mw)
... nids = browser.selected_notes()
... notes = []
... for nid in nids:
...   note = mw.col.get_note(nid)
...   lecture_notes = f'<h2>Text</h2>{note["Text"]}<h2>Extra</h2>{note["Extra"]}'
...   note["Lecture Notes"] = lecture_notes
...   notes.append(note)
... 
... mw.col.update_notes(notes)
blocked main thread for 6704ms:
  File "<string>", line 1, in <module>
  File "aqt", line 509, in run
  File "aqt", line 717, in _run
  File "aqt.debug_console", line 294, in onDebugRet
  File "<string>", line 12, in <module>
  File "anki.collection", line 496, in update_notes
  File "anki._backend_generated", line 1265, in update_notes
  File "anki._backend", line 162, in _run_command

Do you know if this is an expected output message? I perused through some of the cards (obviously not all 30000+) and it seems to have worked, but I don’t get an output at all when I run the debug code on just a few cards.

p.s. please ignore previous edits, I figured out the old error

This error is nothing to worry about. The notes should still get edited.

Yes, the code prints no output.

Gotcha. I appreciate your help! The v12 upgrade went smoothly.

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