-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat: add use of new filter for instructor dash tabs #38499
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
Open
holaontiveros
wants to merge
9
commits into
openedx:master
Choose a base branch
from
WGU-Open-edX:feat/add-filter-instructor-tabs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fe196be
feat: added use of new filter for instructor dash tabs
holaontiveros a02eaa8
Merge branch 'master' into feat/add-filter-instructor-tabs
holaontiveros 8eb4b46
chore: fix comments
holaontiveros 37480b8
chore: update filters to right version
holaontiveros 0d25393
Merge branch 'master' into feat/add-filter-instructor-tabs
holaontiveros f287be2
chore: lint fix and test impriove
holaontiveros b2012f8
chore: fix bad patch
holaontiveros caffee2
Merge branch 'master' into feat/add-filter-instructor-tabs
holaontiveros 49164dd
chore: fix comments
holaontiveros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| from django.utils.html import escape | ||
| from django.utils.translation import gettext as _ | ||
| from edx_when.api import is_enabled_for_course | ||
| from openedx_filters.learning.filters import InstructorDashboardTabsRequested | ||
| from rest_framework import serializers | ||
|
|
||
| from common.djangoapps.course_modes.models import CourseMode | ||
|
|
@@ -305,6 +306,19 @@ def get_tabs(self, data): | |
| 'sort_order': 110, | ||
| }) | ||
|
|
||
| try: | ||
| # .. filter_implemented_name: InstructorDashboardTabsRequested | ||
| # .. filter_type: org.openedx.learning.instructor.dashboard.tabs.requested.v1 | ||
| filtered_tabs = InstructorDashboardTabsRequested.run_filter( | ||
| tabs=tabs, | ||
| user=request.user, | ||
| course_key=course_key | ||
| ) | ||
| custom_tabs = filtered_tabs if filtered_tabs is not None else tabs | ||
| except InstructorDashboardTabsRequested.PreventTabsGeneration as exc: | ||
| # Plugin provided custom tabs or prevented tab generation | ||
| custom_tabs = getattr(exc, 'tabs', []) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a proper test for this? |
||
|
|
||
| # We provide the tabs in a specific order based on how it was | ||
| # historically presented in the frontend. The frontend can use | ||
| # this info or choose to ignore the ordering. | ||
|
|
@@ -322,8 +336,7 @@ def get_tabs(self, data): | |
| 'special_exams', | ||
| ] | ||
| order_index = {tab: i for i, tab in enumerate(tabs_order)} | ||
| tabs = sorted(tabs, key=lambda x: order_index.get(x['tab_id'], float("inf"))) | ||
| return tabs | ||
| return sorted(custom_tabs, key=lambda x: order_index.get(x['tab_id'], float("inf"))) | ||
|
|
||
| def get_course_id(self, data): | ||
| """Get course ID as string.""" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just a missing blank line here