st3v3nmw / obsidian-spaced-repetition

Fight the forgetting curve by reviewing flashcards & entire notes on Obsidian
https://www.stephenmwangi.com/obsidian-spaced-repetition/
MIT License
1.53k stars 184 forks source link

[BUG] Obsidian SRS ignores more than one tag #495

Closed putzwasser closed 7 months ago

putzwasser commented 2 years ago

Describe the bug Obsidian SRS ignores more than one tag. It seems as if the algorithm stops assigning a card/note to decks after it matched the first tag it knows.

To Reproduce

  1. Create this flashcard:
---
tags:
  - flashcard
  - flashcard/test
  - flashcard/test2
  - otherFlashcardTag
---
**Spaced repetition** is an **evidence-based** learning technique that is usually performed with **flashcards**.

Newly introduced and more difficult flashcards are shown **more frequently**.
  1. Add #otherFlashcardTag to the list of flashcard tags.
  2. Open the review modal.
  3. The card will be filed under flashcard only.

Expected behavior The card should be IMHO filed under

I would at least expect the card to filed under flashcard and otherFlashcardTag. It would be best if it belonged to all three decks.

Use case: A flashcard for marketing that is about market research and customer behaviour. I'd file the card under #marketing/marketResearch and #marketing/customerBehaviour and maybe cognitiveBias. So, I'd like to study the card if I study the marketing/marketResearch or the marketing/customerBehaviour deck or the whole marketing deck if got a lot of time. Furthermore I'd like to see the card if I study cognitiveBiases.

Screenshots image Shows the file and that it only belongs to the flashcard deck. image List of tags

Versions (please complete the following information):

ronzulu commented 10 months ago

Hi @putzwasser @pikatwinky @MostlyArmless

I might be able to look at the merge conflict https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/506, but first have a note regarding functionality.

#flashcards/tag1 
#flashcards/tag2 
#flashcards/tag3
question1::answer1

#flashcards/tag4 
#flashcards/tag5
question2::answer2

From a look at the PR, all questions will be included in the complete set of decks #flashcards/tag1... #flashcards/tag5.

There would be an argument for the following deck assignment: question1 - #flashcards/tag1, #flashcards/tag2, #flashcards/tag3 question2 - #flashcards/tag4, #flashcards/tag5

However, this would be different to what is in the PR, (and harder to implement).

Also, not sure if the PR handles multiple inline tags within a question, such as:

#flashcards/tag6 #flashcards/tag7 #flashcards/tag8 question3::answer3

Cheers Ronny

pikatwinky commented 10 months ago

Hi Ronny! Yes, i think the design you described here would be the ideal case, and i understand it could be more complex to implement this:

There would be an argument for the following deck assignment: question1 - #flashcards/tag1, #flashcards/tag2, #flashcards/tag3 question2 - #flashcards/tag4, #flashcards/tag5

In my humble opinion, I see the usefulness of this PR, for the time being, as long as (following your example) once you review question1 in any of the decks #flashcards/tag1... #flashcards/tag5 it dissapears from the rest of them as well. I don't know if this is the actual behaviour of this PR?

ronzulu commented 9 months ago

Hi @putzwasser, I agree about...

In my humble opinion, I see the usefulness of this PR, for the time being, as long as (following your example) once you review question1 in any of the decks #flashcards/tag1... #flashcards/tag5 it dissapears from the rest of them as well. I don't know if this is the actual behaviour of this PR?

Regarding counting, I suggest that the card is included in each deck in which it is tagged.

However it should only be counted once for any decks that are common ancestors. For example:

#flashcards/subject1/topic1
#flashcards/subject1/topic2
#flashcards/subject2/topic3
question1::answer1

I.e. question1 would be counted once in each of the following decks:

#flashcards/subject1/topic1
#flashcards/subject1/topic2
#flashcards/subject2/topic3
#flashcards/subject1
#flashcards/subject2
#flashcards

Specifically, not counted twice for #flashcards/subject1, even though it appears in two subdecks.

@MostlyArmless how is pull request https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/506 going? I might be able to work on this if you are too busy

Regards Ronny

pikatwinky commented 9 months ago

Hi @MostlyArmless. Are you ok with @ronzulu solving the #506 merge conflicts?

Thanks for your kindly help Ronny, i think this overlapping functionality is gonna be an amazing addition to this fantastic plugin

MostlyArmless commented 9 months ago

@pikatwinky @ronzulu yes, if you have time to resolve the merge conflicts please go ahead I haven't had time to fix them myself due to the holidays.

ronzulu commented 9 months ago

Actually, it's a little more involved than we thought, because questions can have their own question specific tags.

So for example:

#flashcards/tag1 
#flashcards/tag2 
#flashcards/tag3
question1::answer1
question2::answer2

#flashcards/tag4 question3::answer3

question4::answer4

The existing functionality would have:

But if we simply look for all tags in the note then question1, question2, question4 will be assigned to:

This means that we can't use the obsidian function getAllTags that is currently used as it doesn't give any info about where in the note the tag is located: export function getAllTags(cache: CachedMetadata): string[] | null;

Fortunately there appears to be richer tag info available from: CachedMetadata tags?: TagCache[];

The location info within TagCache will need to be compared with info from the parser to determine if a tag is question specific or not.

This will take more time to implement...

Cheers Ronny

ronzulu commented 9 months ago

Hi all, I have completed the update but would appreciate beta testing and feedback before I finalise the PR.

The draft PR together with the updated code is available at: https://github.com/st3v3nmw/obsidian-spaced-repetition/pull/834

Cheers Ronny

ronzulu commented 7 months ago

Released into 1.12.0

ikelos555 commented 7 months ago

Now, unrelated tags are shown as well, which makes the whole appearance a bit messy. E.g. my tag for marking flashcards is "#flashcard", but sometimes there are a couple other unrelated tags added to the note, like date tags and so on. Now the UI is clustered with all unrelated tags as well, not only the #flashcard tag and its sub-tags (#flashcard/sub1).

ronzulu commented 7 months ago

Thanks for reporting this, but I can't reproduce the problem.

Please open a new issue and post your markdown file (attachment, not copy/paste), as well as a screenshot of the card selection modal. I assume when you say "Now the UI is clustered..." the card selection modal is what you mean.

Also please post your settings file, e.g.: D:\Obsidian\Obsidian\.obsidian\plugins\obsidian-spaced-repetition\data.json

Cheers Ronny