Skip to content

feat: add DashboardContextEnricher pipeline step for student dashboard filter#2552

Open
pwnage101 wants to merge 4 commits intomasterfrom
pwnage101/ENT-11569
Open

feat: add DashboardContextEnricher pipeline step for student dashboard filter#2552
pwnage101 wants to merge 4 commits intomasterfrom
pwnage101/ENT-11569

Conversation

@pwnage101
Copy link
Copy Markdown
Contributor

@pwnage101 pwnage101 commented Mar 5, 2026

Jira: ENT-11569

Summary:
A DashboardContextEnricher pipeline step is defined in enterprise/filters/dashboard.py and injects all enterprise dashboard context keys (enterprise_message, consent_required_courses, is_enterprise_user, and enterprise portal keys). Unit tests cover the pipeline step with enterprise and non-enterprise users.

@pwnage101
Copy link
Copy Markdown
Contributor Author

Note for implementer: add openedx-filters to requirements.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 96.77419% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.93%. Comparing base (79fb87c) to head (972b1d0).

Files with missing lines Patch % Lines
enterprise/filters/dashboard.py 96.77% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2552      +/-   ##
==========================================
+ Coverage   85.91%   85.93%   +0.02%     
==========================================
  Files         250      251       +1     
  Lines       16604    16635      +31     
  Branches     1639     1640       +1     
==========================================
+ Hits        14266    14296      +30     
- Misses       2001     2002       +1     
  Partials      337      337              
Flag Coverage Δ
unittests 85.93% <96.77%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kiram15 kiram15 force-pushed the pwnage101/ENT-11569 branch from 1683210 to ec97806 Compare April 16, 2026 22:49
@kiram15 kiram15 marked this pull request as ready for review April 17, 2026 20:45

try:
enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments)
except Exception: # pylint: disable=broad-except
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

AI added these exception handlers, but I'm not really a fan of them. If we didn't catch exceptions before, let's not just randomly start doing it, especially if we don't even know the specific exception and are forced to disable broad-except which is a bad code smell. Furthermore, swallowing the exception is probably extra bad for visibility of regressions during local/stage testing.

enterprise learner portal context keys.
"""

def run_filter(self, context, template_name): # pylint: disable=arguments-differ
Copy link
Copy Markdown
Contributor Author

@pwnage101 pwnage101 Apr 17, 2026

Choose a reason for hiding this comment

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

Nit: I feel like the function signature should have type hints, at least the inputs for now:

Suggested change
def run_filter(self, context, template_name): # pylint: disable=arguments-differ
def run_filter(self, context: dict[str, Any], template_name: str): # pylint: disable=arguments-differ

Just copy the types from the filter itself: https://github.com/openedx/openedx-filters/blob/d517006b0f61050f027de90459e50e2745825992/openedx_filters/learning/filters.py#L829C34-L829C48

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