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

Export/import a deck without configuration #31

Open
axelboc opened this issue Aug 7, 2018 · 13 comments
Open

Export/import a deck without configuration #31

axelboc opened this issue Aug 7, 2018 · 13 comments

Comments

@axelboc
Copy link

axelboc commented Aug 7, 2018

  1. Let's say I have a deck in Anki with configuration A = 10 new cards + 100 reviews / day.
  2. I export the deck with CrowdAnki.
  3. I switch the deck to configuration B = 5 new cards + 50 reviews / day.
  4. I re-import the deck.
  5. Deck has configuration A again instead of B.

This behaviour is problematic notably when users try to update a deck to a newer version. Is there any way exporting/importing a deck could not export/import the deck configuration? I tried removing keys deck_configurations and deck_config_uiid from the exported JSON before re-importing it, but I get an error 😢 :

Traceback (most recent call last):
  File "...\addons\crowd_anki\main.py", line 23, in on_import_action
    AnkiJsonImporter.import_deck(aqt.mw.col, import_directory)
  File "...\addons\crowd_anki\anki_importer.py", line 68, in import_deck
    importer.load_from_directory(directory_path, import_media)
  File "...\addons\crowd_anki\anki_importer.py", line 44, in load_from_directory
    self.load_from_file(directory_path.joinpath(directory_path.name).with_suffix(DECK_FILE_EXTENSION))
  File "...\addons\crowd_anki\anki_importer.py", line 27, in load_from_file
    deck = Deck.from_json(deck_json)
  File "...\addons\crowd_anki\representation\deck.py", line 154, in from_json
    deck.deck_config_uuid = json_dict["deck_config_uuid"]
KeyError: 'deck_config_uuid'
@Stvad
Copy link
Owner

Stvad commented Aug 7, 2018

I don't think you can get there by modifying JSON. To get this functionality, this has to be made explicitly configurable

@johnlawrenceaspden
Copy link

It does seem really bad to fiddle with the configurations, they're not part of the deck, they're part of how the particular anki user is using the deck. Two people sharing the same deck might want different learning rates, e.g.

It would probably be best to drop this config/import export entirely, and if you import a new deck, give it the user's default configuration.

@Stvad
Copy link
Owner

Stvad commented Jul 27, 2019

I see that this can be problematic, but I also see the value in the "full export", so the deck would be fully self-contained.
I believe that making this configurable would be valuable

@gabbard
Copy link

gabbard commented Oct 9, 2019

@Stvad : I second @johnlawrenceaspden that this can be a big problem; in my case I'm trying to coordinate an evolving deck between five people, all of whom need different deck configurations because they are different ages!

I would be happy to take a stab at making this configurable when I have some free time in mid-November, if no one else has fixed it by then.

@johnlawrenceaspden
Copy link

johnlawrenceaspden commented Oct 9, 2019

Having thought about this in the intervening months, and used crowdanki in anger a great deal, I think it's [config export/import] a really bad feature. As well as being one more thing to go wrong, it means that every time you re-import the deck it destroys your configuration, and even changes the configuration of other unrelated decks which are using the same config.

When you first import a deck, then ok, bring the deck's config in (although personally I'd prefer it to just use my default config), but I think the default when importing a deck that already exists should be not to touch configurations at all.

If there's a case for exporting a deck 's config at all, then make that a once-and-for all option, rather than making the user choose every time. Exporting already involves far too much error-prone clicking!

In fact it would be much better if "CrowdAnki:Export to disk" were a separate option on the File menu, like importing is, so that it could remember where to export it to! And maybe "Export to disk with configuration" could be a separate option on that menu?

@ohare93
Copy link
Contributor

ohare93 commented Oct 17, 2019

Completely agree, this is a major issue. I want CrowdAnki to have nothing to do with my deck configurations, to me it is all about the notes themselves.

This seems linked to Issue #23 as both are about options for the user to export/import their deck content in the way that they like.

For people managing their decks in Github the option to export/import a file with simply:


{
    "__type__": "DeckWithoutHeaders"
}

as the header would be wonderful. Instead of:

{
    "__type__": "Deck",
    "children": [],
    "crowdanki_uuid": "3cc64d84-e410-11e9-960e-d8cb8ac9abf0",
    "deck_config_uuid": "3cc64d85-e410-11e9-960e-d8cb8ac9abf0",
    "deck_configurations": [
        {
            "__type__": "DeckConfig",
            "autoplay": true,
            "crowdanki_uuid": "3cc64d85-e410-11e9-960e-d8cb8ac9abf0",
            "currentValue": 120,
            "dyn": false,
            "lapse": {
                "delays": [
                    10,
                    1440
                ],
                "leechAction": 1,
                "leechFails": 8,
                "minInt": 1,
                "mult": 0.25
            },
            "maxLife": 120,
            "maxTaken": 60,
            "name": "LL Default",
            "new": {
                "bury": false,
                "delays": [
                    1,
                    15
                ],
                "initialFactor": 2500,
                "ints": [
                    5,
                    10,
                    7
                ],
                "order": 0,
                "perDay": 10,
                "separate": true
            },
            "recover": 5,
            "replayq": true,
            "rev": {
                "bury": true,
                "ease4": 1.5,
                "fuzz": 0.05,
                "hardFactor": 1.2,
                "ivlFct": 1.5,
                "maxIvl": 36500,
                "minSpace": 1,
                "perDay": 70
            },
            "timer": 0
        }
    ],
    "desc": "",
    "dyn": 0,
    "extendNew": 10,
    "extendRev": 50,
    "name": "LL::1. Vocab"
}

I also may have time in about a month, I hope we can collaborate and get this sorted 👍

@ohare93
Copy link
Contributor

ohare93 commented Nov 12, 2019

Not working on this one just now, busy with other things 😞

@gabbard if you're still up for trying to fix this issue this month or whenever, please make it a config setting 👍 see PR #66, and the new config window in Anki 😁 👍

@gabbard
Copy link

gabbard commented Nov 12, 2019

@ohare93 : I was just cloning this repository to work on this task this week. :-)

@ohare93
Copy link
Contributor

ohare93 commented Dec 4, 2019

@gabbard any progress on this? 🙂

@gabbard
Copy link

gabbard commented Dec 4, 2019

@ohare93 : Unfortunately I didn't get the chance to work on it when I hoped I would. :-( I might have some time over Christmas break, but I can't promise anything, so anyone else who'd like to take a stab at it should feel free.

@ohare93
Copy link
Contributor

ohare93 commented Jul 5, 2020

Going to bring this review comment in PR #72 about "Deck Headers" out to the top level here into this issue as it got rather long, and I'd be interested in the opinions of others here as it is very related to Deck Configurations/Options. See https://github.com/Stvad/CrowdAnki/pull/72/files/2e97a78e92ff825dd64e8f5d0e370a6c3740f632#r449796912 for full context (not too long)

I'm not sure if it's useful to combine all those things together. I find it confusing, I think I won't be alone.
Deck options can be separated out and it makes sense to do so #31
But CrowdAnki is build on the notion of the Deck, I'd say it wont be straightforward to diverse it from the notion of a deck and I'm not sure if it makes sense to do so either

@Stvad

"Deck Headers" are just my description to make sense of all the other stuff in an export that isn't Media, Notes, or Note Models. Could you draw a more concrete separation of which are deck 'options' and which are deck 'info' (or whatever other word) in your opinion? The only concrete one I would currently agree with is the deck description, that is obviously a part of the deck but not the options. However the options themselves are merely settings on the deck, so I would say, and thus I place them all under the term "headers" (of an import).

I am happy to separate them out into different options, more user choice is always better! In the end I want users to have the following options. Whether to:

Import a deck

If Yes

  • The existing deck is updated, if it exists, or a new deck is created. All cards, old and new, go into this deck (unless stated otherwise by the Do Not Move Existing Cards config option)

If No

  • Old cards stay where they are (ala, the Do Not Move Existing Cards config option)
  • New cards go into the Default deck, or perhaps the user may choose in the window.

Import deck 'options' (the review schedule info)

If Yes, and Import Deck is also Yes

  • The created/existing deck gets these settings for it's Deck options

If Yes, but Import Deck is No

  • ??? Seems to me like this one must auto default to No if Deck is No 🤔

If No

  • Existing deck keeps it's current deck options
  • New deck gets given the Default config, or perhaps the user may choose in the window.

You can see the end result for each is pretty intertwined and almost identical, that is why I bundle these two things together in my mind 🤷 Again, happy to give a separate option to the users, but they are part of the same whole to me.

When these are all optional it will be possible to import a CrowdAnki file which does not contain these entries and the Import Window will simply auto mark these options as unchecked, and make users unable to check them (as they do not exist). Old versions of CrowdAnki would not be able to import a file without these, but since the only way to currently make such a CrowdAnki file is by doing it yourself or with a separate program then that is a decision or Deck Maintainers. At least until the CrowdAnki export gets the same Import Config Window treatment 😉 but that's a bridge we'll cross later!

But CrowdAnki is build on the notion of the Deck, I'd say it wont be straightforward to diverse it from the notion of a deck and I'm not sure if it makes sense to do so either

As to that comment, I repeat my statement from earlier in this issue.

I want CrowdAnki to have nothing to do with my deck configurations, to me it is all about the notes themselves.

I posit that there is not one person in existence that uses/desires CrowdAnki to export/import Deck Config options! 😆 especially those of other shared decks that are not their own. Deck options are very personal to the individual and change constantly with circumstance. I can understand if a users wishes to back up their own personal config options once in a while, perhaps, but I really do not think anyone actually gets use out of that 🤨 It should stay as an option for imports, but I hope we'll get to a future where CrowdAnki files do not require it (and at that point I posit that most of them will no longer have it).

@axelboc
Copy link
Author

axelboc commented Jul 13, 2020

I posit that there is not one person in existence that uses/desires CrowdAnki to export/import Deck Config options!

I totally agree. The term crowd in CrowdAnki does make it clear that the add-on is about sharing decks between many people, and nobody wants someone else's deck config. IMO, exporting/importing deck configs is a feature that would be more relevant to a backup add-on of some sort.

That being said, it doesn't cost much to keep this feature in CrowdAnki, but it should definitely be optional and disabled by default.

I couldn't find the actual comment you mention about "deck headers", in #72, but a UI of this sort could make sense to me:

  1. Top-level checkbox labelled "Import the deck".
    • Ticked by default.
    • If unticked, notes are just updated in place like the "Do Not Move Existing Cards" option.
  2. Checkbox group labelled "Import deck headers".
    • Disabled if first checkbox is unticked.
    • Contains one checkbox per deck header part (deck description, deck config)

That being said, I don't see a use case for importing the deck without its description, and if you remove this checkbox from the group, all that's left is the deck config... unless there are other deck header parts ? If not, then perhaps the checkbox group could just be a checkbox labelled "Import deck config", unticked by default.

Back to the first checkbox, if I understand correctly, not importing the deck is like ticking the "Do Not Move Existing Cards" option, except that new cards are added to the standard deck. Using the standard deck for new cards seems to make more sense, since users who move cards into other decks would want to move new cards as well, and I believe the standard deck disappears when it contains no more cards (thus, they don't have to delete the imported deck after moving the cards). Therefore, I think this could replace the Do Not Move Existing Cards option.

@ccalvaro
Copy link

Hello,

I have had this problem and founded this issue after "resolving" it. My problem was that all decks changed the options to the imported deck options when importing Ultimate Geography deck through CrowdAnki.

Thank God I have noticed the problem shortly after and had the opportunity to use the "on next sync, force the changes in one direction" option.

I want to share this just in case anybody has the same problem before somebody resolves this issue.

To import the deck without the options be changed automatically, I created another user only for this, imported the deck through CrowdAnki and after exported it as an apkg file. I removed that created user and after that imported it as a regular deck on my user.

Hope this helps somebody,

Greetings

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

No branches or pull requests

6 participants