Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

vocabulary doesn't display in learningresources pane #521

Closed
pwilkins opened this issue Aug 14, 2015 · 5 comments
Closed

vocabulary doesn't display in learningresources pane #521

pwilkins opened this issue Aug 14, 2015 · 5 comments

Comments

@pwilkins
Copy link
Contributor

When a learningresource has a term assigned in a vocabulary, I expect to see the vocabulary in the learningresource pane. Here is a screen shot where this doesn't happen. This is the DemoX course on lore-ci. http://lore-ci.herokuapp.com/repositories/animating-stuffed-animals/?sortby=nr_views&selected_facets=77_exact:210

screen shot 2015-08-14 at 5 04 54 pm

@pwilkins pwilkins added the bug label Aug 14, 2015
@Ferdi
Copy link
Contributor

Ferdi commented Aug 14, 2015

Which vocabulary do you expect to see there?

  • Sent from my phone

@pwilkins
Copy link
Contributor Author

I expect to see the "Difficulty" vocabulary. The list is filtered to show only learningresources that have the "Hard" term from "Difficulty" vocabulary selected. I expect that the LR pane display that vocabulary with "Hard" selected.

@ShawnMilo
Copy link
Contributor

I believe this is not a bug, but "bad" data.

Click on any of the terms under the Vocab 1 heading and it will behave exactly as you expect.

Background: When you add a new vocabulary, you must select which learning resource types to which that vocabulary applies (see #438 which mentions this). These types are referred to in the logic which displays the screen you are seeing.

The reason is that the Difficulty, Prerequisite, and Learning Objective facets were populated manually (by a script), and did not associate any learning resource types to the Difficulty, Prerequisite, and Learning Objective facets at that time. This is evidently not a required reference in the schema.

@pwilkins pwilkins removed the bug label Aug 17, 2015
@pwilkins
Copy link
Contributor Author

If this is an artifact of the data loading script, is any action needed? Can this be closed with a "Not an issue" label?

@ShawnMilo
Copy link
Contributor

It can be fixed by populating the vocabulary_type many-to-many with every LearningResourceType in existence.

from learningresources.models import LearningResourceType
from taxonomy.models import Vocabulary

vocabs = Vocabulary.objects.filter(
    name__in=('prerequisite', 'difficulty', 'objective'))

# Show original counts.
for vocab in vocabs:
    print vocab.learning_resource_types.count()

for vocab in vocabs.iterator():
    for resource_type in LearningResourceType.objects.all().iterator():
        if resource_type in vocab.learning_resource_types.all():
            print "already there"
            continue
        vocab.learning_resource_types.add(resource_type)

# Show there are higher counts.
for vocab in vocabs:
    print vocab.learning_resource_types.count()

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

No branches or pull requests

4 participants