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

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

Merged
merged 22 commits into from
Mar 9, 2024

Conversation

ronzulu
Copy link
Collaborator

@ronzulu ronzulu commented Jan 11, 2024

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
Copy link
Collaborator Author

ronzulu commented Jan 12, 2024

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

@pikatwinky
Copy link

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

@ronzulu
Copy link
Collaborator Author

ronzulu commented Jan 13, 2024

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 ronzulu changed the title Support multi-deck cards #495 Support multi-deck cards #495, and multiple decks in a single note #705 Jan 13, 2024
@Steindvart
Copy link
Contributor

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

@pikatwinky
Copy link

pikatwinky commented Jan 13, 2024

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

@Lucas256-cmd
Copy link

Lucas256-cmd commented Jan 13, 2024

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 :)

CHANGELOG.md Outdated Show resolved Hide resolved
@ronzulu
Copy link
Collaborator Author

ronzulu commented Jan 15, 2024

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
Copy link
Collaborator Author

ronzulu commented Jan 18, 2024

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!

@pikatwinky
Copy link

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

@ronzulu
Copy link
Collaborator Author

ronzulu commented Jan 22, 2024

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

@pikatwinky
Copy link

pikatwinky commented Jan 22, 2024

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!

@ronzulu
Copy link
Collaborator Author

ronzulu commented Jan 23, 2024

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

@pikatwinky
Copy link

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?

@ronzulu
Copy link
Collaborator Author

ronzulu commented Jan 26, 2024

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

@pikatwinky
Copy link

pikatwinky commented Jan 27, 2024

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

@ronzulu
Copy link
Collaborator Author

ronzulu commented Jan 28, 2024

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

@pikatwinky
Copy link

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

@ronzulu ronzulu marked this pull request as ready for review February 3, 2024 09:57
@ronzulu
Copy link
Collaborator Author

ronzulu commented Feb 3, 2024

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
Copy link
Collaborator Author

ronzulu commented Feb 15, 2024

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

Copy link
Owner

@st3v3nmw st3v3nmw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ronzulu,

I had tested this manually and it looks good to me. Thanks!

@st3v3nmw st3v3nmw merged commit 77c4809 into st3v3nmw:master Mar 9, 2024
1 check passed
@ronzulu ronzulu deleted the bug-495-multiple-deck-tags-ignored branch August 7, 2024 04:17
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

Successfully merging this pull request may close these issues.

5 participants