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

Add filter-by-language to study list #1344

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

rhodricusack
Copy link
Contributor

There are many English studies on lookit and at present only one Japanese one. We are worried that on the studies list page, the mass of English studies will be off-putting and confusing, and rarely useful. So, this commit:

  • adds a language field to each study (studies/models.py), giving the default of 'en'
  • on the study list page web/templates/web/studies-list.html we then add a new drop-down to filter by language, currently we three options: All, English or Japanese. For English this defaults to All but if the URL country code is ja, it defaults to Japanese (thus filtering for Japanese studies). Note this is stored in a browser cookie and so will only be picked up the first time you hit the page.

Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@okaycj okaycj left a comment

Choose a reason for hiding this comment

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

This is such a nice add. Just the one issue to resolve.

Comment on lines +474 to +478
class StudyLanguage(FormChoiceEnum):
all = ("*", _("All languages"))
english = ("en", _("English"))
japanese = ("ja", _("Japanese"))

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow! This is great. The filter drop-down would need to have the languages of all available studies.

Copy link
Contributor

Choose a reason for hiding this comment

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

How to do that, I am unsure at this moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At present, we believe there are only ja and en studies. But did you mean you'd like to automatically populate this list by querying the available studies?

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct. If someone were to create a Spanish study, they wouldn't be able to use this filter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@okaycj is correct, if we want to create a language filter for studies (which is a great idea!), we should go ahead and build the capacity to do it for any of the other languages we support.

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.

3 participants