obsidian-spaced-repetition icon indicating copy to clipboard operation
obsidian-spaced-repetition copied to clipboard

Support multi-deck cards #495, and multiple decks in a single note #705

Open ronzulu opened this issue 1 year ago • 19 comments

This PR addresses issues: #178 #495 #705

For example, in the following:

#flashcards/language/words #flashcards/trivia #flashcards/learned-from-tv

A group of cats is called a::clowder

#flashcards/language/words
A group of crows is called a::murder
The branch of medical science dealing with the classification of diseases::nosology

#flashcards/trivia 
The 1988 movie "Mystic Pizza" launched the career of what 'Pretty Woman?' actress::Julia Roberts
What is Australia’s most popular spread?::Vegemite
Who was Australia’s first female prime minister?::Julia Gillard
Question Decks
A group of cats is called a::clowder #flashcards/language/words #flashcards/trivia #flashcards/learned-from-tv
A group of crows is called a::murder #flashcards/language/words
The branch of medical science dealing with the classification of diseases::nosology #flashcards/language/words
The 1988 movie "Mystic Pizza" launched the career of what 'Pretty Woman?' actress::Julia Roberts #flashcards/trivia
Etc

Syntax

For a question to appear in multiple decks, preceding the question in the file must be the list of tags on the same line, such as:

#flashcards/language/words #flashcards/trivia #flashcards/learned-from-tv
A group of cats is called a::clowder

The list of deck(s) can be changed using this format multiple times within a single note.

The list of deck(s) can be included in the frontmatter, in which case multiple tags can be on multiple lines, such as:

---
tags:
  - flashcards
  - flashcards/learned-from-tv
---

A question specific tag takes precedence over the note-level tags described above. For example, in the following:

  • "Q1::A1" is in deck #flashcards/spatial
  • "Which 1986 movie..." is in deck #flashcards/trivia, i.e. the last note-level tag
#flashcards/trivia 
The 1988 movie "Mystic Pizza" launched the career of what 'Pretty Woman?' actress::Julia Roberts

#flashcards/spatial Q1::A1

Which 1986 movie is the highest-grossing Australian movie of all time?::Crocodile Dundee

Card counting

Multi-deck cards are only counted once, e.g.:

  • There are 6 cards, so at (1) the total shown is 6

In the case of multi-deck cards, totals may not add up. E.g. under flashcards is language, learned-from-tv and trivia. Those decks have 3, 1, 4 cards listed respectively, totaling 8. Which is 2 more than the total of 6 shown at (1). This is because the A group of cats is called a::clowder question is present in 3 decks, but is only counted as if it was in one.

image

Reviewing

A multi-deck card will only be shown once. For example, after reviewing only the learned-from-tv deck, the counts are: image

The new-card counts in blue, across the 3 decks in which the cat question appears, have all decreased by 1.

i.e. lines (3) (4) and (5). (2) has also decreased as it is the parent of (3).

Backward Compatibility

For compatibility with plug-in functionality before this PR, if there are no note-level tags prior to a question, and that question doesn't have a question specific tag, the question will be placed in the deck specified by the first tag found after the question within the file.

e.g. if the complete content of a note is:

The 1988 movie "Mystic Pizza" launched the career of what 'Pretty Woman?' actress::Julia Roberts
What is Australia’s most popular spread?::Vegemite
Who was Australia’s first female prime minister?::Julia Gillard

#flashcards/backward-compatibility

All the questions will be found in deck #flashcards/backward-compatibility

Beta Testing & Feedback

Yes please!

ronzulu avatar Jan 11 '24 12:01 ronzulu

Hi all

Beta release is now available.

There is a file called main.js in this zip file main_495A.zip

You will need to copy that to the obsidian plug-in folder, e.g. D:\Obsidian\Obsidian\.obsidian\plugins\obsidian-spaced-repetition

Then reload the plug-in, or restart obsidian.

Any feedback appreciated.

Ronny

ronzulu avatar Jan 12 '24 00:01 ronzulu

Hi Ronny, thank you so much for your hard work. All we use this plugin really appreciate it.

Im not very tech skilled, but i wanted to give a try to this beta version (using the sandbox vault first and then with my own vault also restarting the plugin in the second case); so i copied the main.js file in the plugin route, but when using it my existent cards are not shown in the review window image

pikatwinky avatar Jan 12 '24 17:01 pikatwinky

Hi @pikatwinky thanks for trying, and oops that's not a good start!

Please attach one of your Markdown .md files so I can isolate the problem.

Also, can you send a screenshot of the relevant settings, including: image

Cheers Ronny

ronzulu avatar Jan 13 '24 00:01 ronzulu

A great addition! This is exactly what I REALLY miss in using this plugin 😅.

In basic case is work fine in my test Obsidian vault.

image

image

image

steindvart avatar Jan 13 '24 13:01 steindvart

Hi @ronzulu, i tried with the sandbox vault and with my own vault. In both cases i use this settings image image

The md i use in each case looks like this Sandbox vault image My own vault: image

I copied the main.js file in the plugin's route, but at reviewing time the cards aren't shown and the window looks as in my previous attachment I tried restarting both the plugin and obsidian. Im using the latest obsidian version btw

Edit: Maybe im doing something wrong cause the plugin's note review feature works properly, but also when i return to the current release, those flashcards load without any problem

pikatwinky avatar Jan 13 '24 23:01 pikatwinky

So I had a file with a lot of hierarchical (if this is even a word:) ) card tags. 3 layers deep, some with one deck in them some with more. I downloaded the zip, put the file where it belongs, reloaded obsidian AND IT WORKED LIKE A CHARM. Thank you. This is exactly how i had it in mind since the tags where already in the file before you added this functionality. You added it and it just works. EDIT: I didn't use tags in front matter or something. I'm not that advanced yet :)

Lucas256-cmd avatar Jan 13 '24 23:01 Lucas256-cmd

Hi @pikatwinky from your screenshots you have done everything correctly.

Could you please zip up your test vault and post here. Hopefully I'll be able to reproduce the issue at my end.

Thanks Ronny

ronzulu avatar Jan 15 '24 13:01 ronzulu

Hi @pikatwinky from your screenshots you have done everything correctly.

Could you please zip up your test vault and post here. Hopefully I'll be able to reproduce the issue at my end.

Thanks Ronny

Sorry to hassle you, would be great if you can send this through. Many thanks!

ronzulu avatar Jan 18 '24 10:01 ronzulu

Hi @pikatwinky from your screenshots you have done everything correctly. Could you please zip up your test vault and post here. Hopefully I'll be able to reproduce the issue at my end. Thanks Ronny

Sorry to hassle you, would be great if you can send this through. Many thanks!

Hi Ronny, sorry for the late reply. I had that problem using the sandbox vault and a personal vault. Unfortunately i cant publish the personal one. Does the sandbox work for you? Maybe i did something wrong with my process which was the next one: -Open Sandbox vault -Download Spaced Repetition plugin -Open Obsidian's Spaced Repetition plugin folder and paste there the beta main.js file -When returning Obsidian plugin wasn't working even after restarting from the plugins section

pikatwinky avatar Jan 22 '24 04:01 pikatwinky

Hi @pikatwinky

I don't know why I didn't think of it before, but here is a demo vault with the beta version of main.js. Vault_495A.zip

When I open the vault, and click on the flashcards icon, I see: image

What do you see?

If you see the same as above, perhaps copy one of your test files into this vault and see what happens. If the beta code doesn't work with your file in this demo vault, please zip it up and post the zip file here.

Thanks for your help!

Cheers Ronny

ronzulu avatar Jan 22 '24 04:01 ronzulu

Hi @pikatwinky

I don't know why I didn't think of it before, but here is a demo vault with the beta version of main.js. Vault_495A.zip

When I open the vault, and click on the flashcards icon, I see: image

What do you see?

If you see the same as above, perhaps copy one of your test files into this vault and see what happens. If the beta code doesn't work with your file in this demo vault, please zip it up and post the zip file here.

Thanks for your help!

Cheers Ronny

Hi @ronzulu. I tested your vault and it works perfectly and the behaviour is as described. Thank you so much for your hard work, we really apreciate it!

pikatwinky avatar Jan 22 '24 16:01 pikatwinky

Hi @pikatwinky great.

Does that mean it works when you copy your file into the test vault?

I assume that the problem still occurs in your main vault? If so, I'll need to send you a version with extra debug to assist diagnosing.

Cheers Ronny

ronzulu avatar Jan 23 '24 02:01 ronzulu

Hi @pikatwinky from your screenshots you have done everything correctly. Could you please zip up your test vault and post here. Hopefully I'll be able to reproduce the issue at my end. Thanks Ronny

Sorry to hassle you, would be great if you can send this through. Many thanks!

Hi Ronny, sorry for the late reply. I had that problem using the sandbox vault and a personal vault. Unfortunately i cant publish the personal one. Does the sandbox work for you? Maybe i did something wrong with my process which was the next one: -Open Sandbox vault -Download Spaced Repetition plugin -Open Obsidian's Spaced Repetition plugin folder and paste there the beta main.js file -When returning Obsidian plugin wasn't working even after restarting from the plugins section

Hi @ronzulu! If the steps i followed here are all right, then yes, all my existent cards still dissapear from the review window, but the other plugin features like the note review work properly. How can i provide you info about this?

pikatwinky avatar Jan 26 '24 02:01 pikatwinky

Hi @pikatwinky

No worries, I understand you can't send through your personal vault. I'm hoping to be able to reproduce the problem on my machine to simplify solving it.

  1. Is there one file from your vault that contains cards that you can copy to the test vault that I sent? Let's call it file 1

  2. What happens in the test vault?

When you click on the flashcards icon, do the cards from file 1 appear, or only the ones that were originally present in the test vault? image

  1. Please take a screenshot of the flashcard review dialog box.

  2. In file 1, are you able to make this as compact as possible that still highlights the problem? E.g. remove all unnecessary text and just keep a single card.

Replace any private info in the file with just boring general text, retaining the flashcard tags.

  1. Does the problem still occur?

  2. As this doesn't have any private info, do you feel comfortable zipping up this test vault and sending it to me?

Sorry for all this hassle, but I think this is a useful new feature and there isn't any point releasing it if it doesn't work for you!

Cheers Ronny

ronzulu avatar Jan 26 '24 04:01 ronzulu

Hi @ronzulu Here i share 3 vaults testing the next simple note: image I'm using the default settings

  • The first is a test vault with the plugin's latest release and one note with one flashcard. In this vault the review window works well image MyTestVault.zip

  • Then in the second vault i copied the beta main.js attached above in the corresponding plugin's route, and after restarting obsidian, the review window doesn't show the card image MyTestVaultAfterUpdate.zip

  • Finally in the vault you shared previously with the beta plugin included, i put this same note but i changed its deck's tag to flashcardsTest only for easy identification.
    image However the flashcard doesn't appear in the review window image

I was expecting a flashcardsTest deck appeared in the window because that tag was added in the settings image

Demo.zip

I hope this info could be found useful

pikatwinky avatar Jan 27 '24 20:01 pikatwinky

Hi @pikatwinky

Thanks so much for the clear and comprehensive info, it enabled me (hopefully) to solve the problem. image

image

If you could please try this version now, and let me know how it goes. main_495B.zip

Cheers Ronny

ronzulu avatar Jan 28 '24 11:01 ronzulu

Hi @pikatwinky

Thanks so much for the clear and comprehensive info, it enabled me (hopefully) to solve the problem. image

image

If you could please try this version now, and let me know how it goes. main_495B.zip

Cheers Ronny

Hi @ronzulu, i tested this new version in my own vault and it works perfectly, thanks again for all your hard work image

pikatwinky avatar Jan 30 '24 03:01 pikatwinky

Hi @st3v3nmw this has been tried out by a few people, and I've fixed the one bug reported.

This PR has required moderate change (more than I anticipated), so a review by you really is needed. The original PR request has a comprehensive description of the enhanced functionality, and I have also updated the English user documentation to match.

Also, will you have time at some stage for us to talk through all the PRs contributed and create a plan?

Cheers Ronny

ronzulu avatar Feb 03 '24 10:02 ronzulu

Hi @st3v3nmw, just wondering how you are - you must be very busy 😄

It would be great if you could review and merge this PR.

Hi @st3v3nmw this has been tried out by a few people, and I've fixed the one bug reported.

This PR has required moderate change (more than I anticipated), so a review by you really is needed. The original PR request has a comprehensive description of the enhanced functionality, and I have also updated the English user documentation to match.

Also, will you have time at some stage for us to talk through all the PRs contributed and create a plan?

Cheers Ronny

ronzulu avatar Feb 15 '24 03:02 ronzulu