Update deck for all cards of a note

Update decks as suggested by louietan/anki-editor#85.
ccd7f77322 only updated one card.
This commit is contained in:
orgtre 2022-10-31 10:47:58 +01:00
parent 1f8b222e08
commit efe454f642

View file

@ -523,11 +523,7 @@ Where the subtree is created depends on PREFIX."
:notes (list (string-to-number :notes (list (string-to-number
(anki-editor-note-id note)))) (anki-editor-note-id note))))
(anki-editor-api-enqueue 'updateNoteFields (anki-editor-api-enqueue 'updateNoteFields
:note (anki-editor-api--note note)) :note (anki-editor-api--note note)))))
(anki-editor-api-enqueue 'changeDeck
:cards (list (string-to-number (anki-editor-note-id note)))
:deck (anki-editor-note-deck note))
)))
(tagsadd (cl-set-difference (anki-editor-note-tags note) (tagsadd (cl-set-difference (anki-editor-note-tags note)
(alist-get 'tags oldnote) (alist-get 'tags oldnote)
:test 'string=)) :test 'string=))
@ -535,6 +531,10 @@ Where the subtree is created depends on PREFIX."
(cl-set-difference (anki-editor-note-tags note) :test 'string=) (cl-set-difference (anki-editor-note-tags note) :test 'string=)
(cl-set-difference anki-editor-protected-tags :test 'string=)))) (cl-set-difference anki-editor-protected-tags :test 'string=))))
(anki-editor-api-with-multi (anki-editor-api-with-multi
(anki-editor-api-enqueue 'changeDeck
:cards (alist-get 'cards oldnote)
:deck (anki-editor-note-deck note))
(when tagsadd (when tagsadd
(anki-editor-api-enqueue 'addTags (anki-editor-api-enqueue 'addTags
:notes (list (string-to-number :notes (list (string-to-number