-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat: filter courses by user language by default #33647
feat: filter courses by user language by default #33647
Conversation
Thanks for the pull request, @navinkarkera! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
0adc71b
to
c86d908
Compare
Sandbox deploy request received. Deployment will start soon. |
Sandbox deployment started. |
c86d908
to
6c71c68
Compare
Sandbox update request received. Deployment will start soon. |
Sandbox deployment successful. Sandbox LMS is available at pr-33647-139931.staging.do.opencraft.hosting |
Sandbox deployment started. |
Sandbox deployment successful. Sandbox LMS is available at pr-33647-139931.staging.do.opencraft.hosting |
6c71c68
to
4f23108
Compare
NOTE:
|
20597e2
to
af1d124
Compare
|
Sandbox update request received. Deployment will start soon. |
Hi @navinkarkera! Is this ready for review? |
@mphilbrick211 Thanks for checking. Yes it is ready. |
81335fa
to
eca9398
Compare
Sandbox deployment successful. Sandbox LMS is available at pr-33647-139931.staging.do.opencraft.hosting Instance config : https://grove-stage-build-logs.nyc3.digitaloceanspaces.com/34602668-5639873435-config.yml |
eca9398
to
13ad42f
Compare
Hi @mphilbrick211 @navinkarkera may I review/merge this as CC? |
13ad42f
to
9a2f9da
Compare
@pomegranited That would be super helpful. Thanks! |
Sure thing @navinkarkera , could you direct me to the ticket? |
@pomegranited BB-8091. Added the ticket info to description as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@navinkarkera This code is working exactly as described, thank you for such great testing instructions!
But I have some questions about the feature flag, and a request for a better test. Please let me know if you have any questions or concerns.
expect($('.courses-listing .course-title')).toContainHtml('edX Demonstration Course'); | ||
expect($('.active-filter').length).toBe(1); | ||
expect($('.active-filter .query')).toContainHtml("English"); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's only ever one course in the returned list, this test doesn't actually verify that the filter was applied.
Could you add another course that uses a different language so we can see that this filter actually applies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that when my preferred language doesn't match any of my course's languages that I see header text like this:
We couldn't find any results for ""
which I think students may find confusing, because the text is confusing, and because the student didn't actually perform an explicit search.
An easy way around this would be to avoid showing that header if there's no search text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's only ever one course in the returned list, this test doesn't actually verify that the filter was applied.
Could you add another course that uses a different language so we can see that this filter actually applies?
@pomegranited Actually the test should not be about checking API response as it is mocked above by AjaxHelpers.respondWithJson(requests, JSON_RESPONSE);
. So I modified to check the request body as it should include language filter automatically when default filter is enabled.
An easy way around this would be to avoid showing that header if there's no search text.
Makes sense. Done 👍
@@ -275,6 +275,7 @@ def courses(request): | |||
""" | |||
courses_list = [] | |||
course_discovery_meanings = getattr(settings, 'COURSE_DISCOVERY_MEANINGS', {}) | |||
set_default_filter = settings.FEATURES.get('ENABLE_COURSE_DISCOVERY_DEFAULT_LANGUAGE_FILTER') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an implementation reason why you chose to add a new settings.FEATURES
flag instead of one of the toggles available from edx-toggles like SettingToggle or WaffleFlag?
It's my understanding from Feature Flags and Settings on edx-platform and OEP-17 that we should be using these edx-toggles now, and that FEATURES flags are deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pomegranited No specific reason for using feature flags, except for maybe the relationship with ENABLE_COURSE_DISCOVERY
feature flag. After reading the the OEP, I think we can using WaffleSwitch
here.
9a2f9da
to
ed3664a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thank you for addressing my comments @navinkarkera :) I'll merge this tomorrow if there are no objections.
Could you update the PR description to reflect the use of a Waffle Switch instead of a feature flag to enable this feature? And will need an update to openedx/edx-documentation#2210 too.
- I tested this on my devstack using the excellent testing instructions in the PR.
- I read through the code
- I checked for accessibility issues by using my keyboard to navigate the Courses list
- Includes documentation on the new switch
-
User-facing strings are extracted for translationN/A
1ef9b38
to
c3eb382
Compare
@pomegranited We probably don't need openedx/edx-documentation#2210 as it will be automatically documented here. |
Adds a feature flag to filter courses by users preferred language by default test: add test
c3eb382
to
f1d79ca
Compare
@navinkarkera Perfect, thank you for fixing that nit and updating your PR description.
Sweet! Feel free to close that then. Merging this now :) |
@navinkarkera 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production. |
2U Release Notice: This PR has been deployed to the edX production environment. |
1 similar comment
2U Release Notice: This PR has been deployed to the edX production environment. |
Description
Adds a waffle switch to filter courses by selected site language by default
Useful information to include:
Private-ref
: BB-8091Testing instructions
lms/envs/private.py
Start lms and cms using
make {lms,cms}-up
Add
courseware.discovery_default_language_filter
waffle switch in django admin.Add a new course or update language of any existing course to some other language.
Go to http://localhost:18000/courses
If you have never set your language via account settings, you should see all the courses without any filters applied.
Now change your language by going to Account page.
English
option is available in theLanguage
field.