Open kylebakerio opened 8 years ago
When I share a deck, the shared user now has a key with my deckname in its repo. I don't want that to be reserved space (it should be possible for other users to also have that name for their deck), so that is bad.
Likewise, when I download a deck, it overwrites anything I have on that key with the new one. It should just append it.
Overwriting a deck is unlikely to be desired. If desired, user could just download new version and delete old version yourself, at user's leisure. However, the real option desired is the ability to get new cards.
Natural solution 1: add a 'card id' to every card. Then you could count how many cards are in the user's deck, and add those with a cardid higher than that index.
Problem with that solution: the user can add their own cards.
Possible solution to that problem: add a third subcategory ('cards'/'unseen' are current two, would add a third 'custom' category, which would be added to when you are adding cards to a deck you are not the owner of.) This makes the rating algorithm more messy, though.
Other possible solution: add a 'custom' flag.
Other (probably best) possible solution: add a 'original length' property to shared decks, and use that instead as the 'compare' index. New updated/added cards get put in 'unseen' category.
^would all 'new' cards would block cards that are ready to be reviewed under current algo? Or do 'unseen' cards only show up after cards ready to review are seen? (<-that would be ideal, if it isn't that way yet.)
NOTE: the above allows adding cards, but not changing or deleting cards. I think it should probably stay that way, but that does mean no typo correction or anything... In theory, though, with the 'card id' there, it is possible to do a one-for-one comparison. But we run into a diffing problem when we find a card that has been updated but was also customized by the downloader...
As for updating decks you have shared:
First solution idea: to make that 'shared' user special with one layer deeper, i.e. App.mindSeal['username'].decks.
Second solution: more complex server rules... if sharing, cycle through shared decks to find a deck with same name if same deck name*, check author name, if same author name, update
^much more server resources intensive, though, and not sustainable. but it leaves structure intact... which isn't really important, but is simpler for right now... but creates technical debt....
also, when a deck is shared, a 'flag' should be kept on that user's copy that indicates it has been shared, and the 'shared' button should now be 'share updates' if more cards added, or grayed out if already shared.
*We also need to account for a situation where a user creates a deck, shares it, and then deletes that deck, and then makes a new one, and is sharing that.
That shouldn't be an update. But does that mean we don't allow it to be shared? That we silently (or verbosely) add a 'version x' tag to its name? That we blank out that namespace for the user (no)?
This has caused a number of headaches--from the 'special characters' bug complexities, but more importantly makes the handling of shared decks more difficult (how to handle when a shared deck has the same name as a local deck? using deck names as keys, this is very messy). This rewrite would fix issues #37, #126, #131