mdanki icon indicating copy to clipboard operation
mdanki copied to clipboard

Duplicates

Open amorriscode opened this issue 5 years ago • 10 comments

This isn't necessarily an issue with mdanki, I am just curious how you manage duplicates.

For example, I add cards to my repo frequently. Once I am done adding some cards, I run mdanki. After this is done, if I just import the file directly I get duplicates in Anki. If I delete the deck and then add the new one, I lose all progress.

What does your workflow look like?

amorriscode avatar Mar 15 '20 20:03 amorriscode

This appears to be an issue in the underlying library. https://github.com/repeat-space/anki-apkg-export/issues/37 calls attention to it. Essentially, https://github.com/repeat-space/anki-apkg-export/blob/master/src/exporter.js#L99 appears to show it using the timestamp of generation to create the card ID. I think if it switched to using something like a hash of the deckName and the card front, you could probably avoid the duplicate problem.

DHNishi avatar Mar 17 '20 08:03 DHNishi

@DHNishi thanks for the investigation. I made a PR over there. We'll see if it gets in!

amorriscode avatar Mar 17 '20 15:03 amorriscode

Thanks, @amorriscode, and @DHNishi for the investigation and the PR. I'll update the dependency when the PR'll be merged to anki-apkg-export

ashlinchak avatar Mar 18 '20 08:03 ashlinchak

Hey all, sorry for the long time. I've released [email protected] with the patch from @amorriscode :+1:

ewnd9 avatar Mar 28 '20 12:03 ewnd9

@ashlinchak I made a PR. 😄

amorriscode avatar Mar 28 '20 12:03 amorriscode

So I realized now that the update of anki-apkg-export doesn't quite solve the problem. The issue being that existing decks don't get loaded and updated. They are just completely regenerated.

amorriscode avatar Mar 30 '20 14:03 amorriscode

Yeah, just checked it :) I believe having this is not enough as those variables are generated based on the topDeckId which is generated based on Date.now() anyway.

ashlinchak avatar Mar 30 '20 16:03 ashlinchak

🤦‍♂ Sorry about that. I suppose the topDeckId should be based off of the deck name itself?

amorriscode avatar Mar 30 '20 16:03 amorriscode

Made a new PR based on some of our ideas. Tested it with mdanki this time.

Not sure if it handles nested decks; that will require more research but it's a start.

amorriscode avatar Mar 30 '20 17:03 amorriscode

So the issues is still here, are you guys moving on from mdanki? do you have some alternative suggestion?

Moanrisy avatar Jan 17 '24 01:01 Moanrisy