Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicates #8

Open
amorriscode opened this issue Mar 15, 2020 · 10 comments · Fixed by #11
Open

Duplicates #8

amorriscode opened this issue Mar 15, 2020 · 10 comments · Fixed by #11

Comments

@amorriscode
Copy link
Contributor

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?

@DHNishi
Copy link

DHNishi commented Mar 17, 2020

This appears to be an issue in the underlying library. repeat-space/anki-apkg-export#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.

@amorriscode
Copy link
Contributor Author

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

@ashlinchak
Copy link
Owner

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

@ewnd9
Copy link

ewnd9 commented Mar 28, 2020

Hey all, sorry for the long time. I've released anki-apkg-export@4.0.3 with the patch from @amorriscode 👍

@amorriscode
Copy link
Contributor Author

@ashlinchak I made a PR. 😄

@amorriscode
Copy link
Contributor Author

amorriscode commented Mar 30, 2020

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.

@ashlinchak ashlinchak reopened this Mar 30, 2020
@ashlinchak
Copy link
Owner

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.

@amorriscode
Copy link
Contributor Author

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

@amorriscode
Copy link
Contributor Author

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.

@Moanrisy
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants