Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Can't prevent duplicates from being added via API #164

Closed
matthewwoo opened this issue May 3, 2020 · 6 comments · Fixed by #171
Closed

Can't prevent duplicates from being added via API #164

matthewwoo opened this issue May 3, 2020 · 6 comments · Fixed by #171

Comments

@matthewwoo
Copy link

First - THANKS so much for creating this API, it's been a lifesaver for me as I try to turn my kindle highlights into anki cards.

One issue I'm having is the ability to prevent duplicate cards from being created. I've set the flag to 'False' but it still allows me to create a duplicate cards.

Here's an example of the JSON object I'm passing through -> https://github.com/matthewwoo/kindle_anki/blob/master/models.py

@snoyes
Copy link
Contributor

snoyes commented May 4, 2020

The duplicateScope option should not be the deck name; it should be the literal word "deck" (as opposed to "global").

@matthewwoo
Copy link
Author

Got it, I'll give that a shot thanks!

@matthewwoo
Copy link
Author

Updated the duplicateScope option to "deck" but I'm still able to create duplicates any thing else I should try?

@snoyes
Copy link
Contributor

snoyes commented May 7, 2020

We cannot know what the various class attributes contain, or what gets done with that afterwards. So instead of showing us your code, show the actual JSON that is finally sent to AnkiConnect.

Even better, enable AnkiConnect's log file, run that note through twice to create the duplicate, and then show the log file which proves that you have identical JSON appearing twice and returning two resulting note IDs instead of an error.

@matthewwoo
Copy link
Author

matthewwoo commented May 8, 2020

Here is the JSON I'm sending an the result I'm getting. Happy to send over the AnkiConnect's log file, but not sure how to enable it (couldn't find in the documentation).
Thanks for all the help on this!


Card 1 JSON

{'deckName': 'default', 'modelName': 'Basic', 'fields': {'Front': ' What is the correlation between market & GDP?\n', 'Back': 'The correlation between the growth of GDP and the growth of corporate profits is 0.98. (1.0 is perfect.) I assume that this long-term relationship will prevail in the years ahead.\n'}, 'options': {'allowDuplicate': False, 'duplicateScope': 'deck'}, 'tags': [' The Little Book of Common Sense Investing by John C. Bogle\n', 'Investing', 'Index Funds', 'John C. Bogle']}

Card 1 Response

1588934391594

Card 2 JSON

{'deckName': 'default', 'modelName': 'Basic', 'fields': {'Front': ' What is the correlation between market & GDP?\n', 'Back': 'The correlation between the growth of GDP and the growth of corporate profits is 0.98. (1.0 is perfect.) I assume that this long-term relationship will prevail in the years ahead.\n'}, 'options': {'allowDuplicate': False, 'duplicateScope': 'deck'}, 'tags': [' The Little Book of Common Sense Investing by John C. Bogle\n', 'Investing', 'Index Funds', 'John C. Bogle']}

Card 2 Response

1588934391620

@snoyes
Copy link
Contributor

snoyes commented May 8, 2020 via email

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

Successfully merging a pull request may close this issue.

2 participants