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

Can't delete cards via CrowdAnki #211

Open
LorenzHorvath opened this issue Jul 19, 2024 · 3 comments
Open

Can't delete cards via CrowdAnki #211

LorenzHorvath opened this issue Jul 19, 2024 · 3 comments

Comments

@LorenzHorvath
Copy link

Hey!

I've recently stumbled across an issue whilst collaborating on a deck with a colleague:

  1. I deleted some cards
  2. I pushed the changes to the repo
  3. He pulled and imported the deck
  4. The cards which I deleted are still present, as they have been present before locally and CrowdAnki seems to encounter them as 'new' cards
  5. He then pushed some unrelated changes, but with them he also pushed the cards I previously deleted on the repo again, inadvertently undoing my changes

Is there anything to be done about this? I couldn't find any config option regarding this issue. 😅

@aplaice
Copy link
Collaborator

aplaice commented Jul 22, 2024

Thanks for reporting! This is unfortunately a known problem with no automatic solution, as of now. In "Ultimate Geography" we work around this by creating a "dummy" deck with the deleted cards, so that the user can import the "dummy" deck (hence moving the cards into it) and then delete it, but this is not really a viable solution for collaboration.


Musings on technical approach

I'm not quite sure what would be the best solution — one option might be to have an extra "deleted.yaml" file in each CrowdAnki repo (or maybe just a field in the JSON??), with the guids/uuids of deleted notes, which would be automatically updated when deleting notes, and on the import side the user would be asked whether they want to delete the remotely deleted notes (and depending on the user's choice either delete them or tag them as something like "crowdanki_deleted", and in both cases ignore them on re-export). The main disadvantage is that the list of deleted notes could never really be pruned. (There might be some others that I can't think of...) (Undeletion would be handled by removing the uuid from the "deleted" list. (Edit: I think this would work correctly both in the case of a user upgrading from the pre-deletion state and the post-deletion (but pre-undeletion) one.))

A more elegant (but in practice also far more complicated...) solution would be to rely on the git repo history to track whether (when importing an existing deck) the absence of a note (i.e. that it is present in the local collection but not in the imported deck) is due to the note having been remotely removed or never present (just like Git normally knows when files/lines are deleted when pulling). The disadvantage would be that this would rely on the diffs being sufficiently clean that git can reliably distinguish deleted notes, and that it'd rely on the deck being imported from a git repo and not just from a file/directory.

@wyohm
Copy link

wyohm commented Jul 22, 2024

One idea on the deck side would be to have a deck version number tag, e.g. "v1". When preparing to push again, add "v2" and remove "v1" for all cards. When others pull, any cards which have "v1" (or don't have "v2") can be deleted.

@LorenzHorvath
Copy link
Author

Thanks for the reply!

A "deleted.yaml" also was the first thing that came to my mind, would surely be a nice addition to the addon!

Our makeshift solution is quite similar to @wyohm's, we just add a DELETE tag to each card we want to "delete" and make sure to suspend all cards tagged DELETE after each pull. Not a nice solution of course, but one that works and doesn't rely on the other party making good on their promise of deleting cards marked for deletion in some way or another before committing.

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

No branches or pull requests

3 participants