Open mnhende2 opened 4 years ago
I'm using anki 2.1.29. It always sets the note id to -1500000000000
i notice on master it is https://github.com/ospalh/anki-addons/blob/5e5660177650b9a56d23100098253552bda3c1cc/add_note_id/__init__.py#L94-L97
but the code as downloaded from the anki addons page is
def onLoadNote(self, *args, **kwargs):
for f in self.note.keys():
if f == config["NoteIdFieldName"] and not self.note[f]:
self.note[f] = str(self.note.id - int(15e11))
when i manually edit the extension locally to use uuid
it works
Replacing the file __init__.py
in the add-ons folder with the file from this repo fixed the problem for me.
i notice on master it is
but the code as downloaded from the anki addons page is
def onLoadNote(self, *args, **kwargs): for f in self.note.keys(): if f == config["NoteIdFieldName"] and not self.note[f]: self.note[f] = str(self.note.id - int(15e11))
when i manually edit the extension locally to use
uuid
it works
If you want the old note id behaviour, instead of the uuid behaviour, the fix for that is to check that the note id isn't - int(15e11) before adding anything.
I removed the subtraction, because for my purposes I need the note id to be the actual note id, so in my case it was auto-filling with 0, because when you first open the add note form, there is no id yet.
I now have
if self.note.id != 0:
self.note[f] = str(self.note.id)
in the onLoadNote section to avoid that, and the correct note id fills in next time it is opened.
I think the problem began a bit earlier that 2.1.29, but I was running a lower version for a few months.