Skip to content

Commit

Permalink
fix: Errors around displaying Superset link
Browse files Browse the repository at this point in the history
  • Loading branch information
bmtcril committed May 16, 2024
1 parent be0b0bd commit 0c0e2b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions platform_plugin_aspects/extensions/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ def run_filter(

user = get_current_user()

user_language = (
get_model("user_preference").get_value(user, "pref-lang") or "en"
)
try:
user_language = (
get_model("user_preference").get_value(user, "pref-lang") or "en"
)
# If there is no user_preferences model defined this will get thrown
except AttributeError:
user_language = "en"

Check failure on line 43 in platform_plugin_aspects/extensions/filters.py

View workflow job for this annotation

GitHub Actions / tests (ubuntu-20.04, 3.8, django42)

Missing coverage

Missing coverage on lines 42-43

formatted_language = user_language.lower().replace("-", "_")
if formatted_language not in [
loc.lower().replace("-", "_") for loc in settings.SUPERSET_DASHBOARD_LOCALES
Expand Down Expand Up @@ -65,6 +70,8 @@ def run_filter(
"template_path_prefix": TEMPLATE_ABSOLUTE_PATH,
"show_dashboard_link": show_dashboard_link,
}

print(section_data)
context["sections"].append(section_data)
return {
"context": context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<%include file="/courseware/xqa_interface.html/"/>
<%
superset_url = section_data.get("superset_url")
show_superset_link = section_data.get("show_dashboard_link")
show_superset_link = superset_url and section_data.get("show_dashboard_link")
%>

<section class="superset">
% if superset_url and show_dashboard_link:
% if show_superset_link:
<div class="superset-link">
<a href="${superset_url}login/openedxsso">${_("View dashboards in Superset")}</a>
</div>
Expand Down

0 comments on commit 0c0e2b4

Please sign in to comment.