diff --git a/requirements/base.in b/requirements/base.in index 71bd01031..44007fd36 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -5,3 +5,4 @@ openedx-atlas transifex-python tutor>=15 ruamel.yaml +shandy-sqlfmt[jinjafmt]==0.21.2 diff --git a/requirements/base.txt b/requirements/base.txt index 8f57eb73d..c46165563 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -10,6 +10,8 @@ asttokens==2.4.1 # via transifex-python bcrypt==4.2.0 # via -r requirements/base.in +black==24.8.0 + # via shandy-sqlfmt cachetools==5.5.0 # via google-auth certifi==2024.8.30 @@ -21,6 +23,8 @@ charset-normalizer==3.3.2 click==8.1.7 # via # -r requirements/base.in + # black + # shandy-sqlfmt # transifex-python # tutor future==1.0.0 @@ -36,7 +40,9 @@ importlib-resources==6.4.5 # -r requirements/base.in # tutor jinja2==3.1.4 - # via tutor + # via + # shandy-sqlfmt + # tutor kubernetes==30.1.0 # via tutor markupsafe==2.1.5 @@ -44,15 +50,25 @@ markupsafe==2.1.5 mypy==1.11.2 # via tutor mypy-extensions==1.0.0 - # via mypy + # via + # black + # mypy oauthlib==3.2.2 # via # kubernetes # requests-oauthlib openedx-atlas==0.6.2 # via -r requirements/base.in +packaging==24.1 + # via black parsimonious==0.10.0 # via pyseeyou +pathspec==0.12.1 + # via black +platformdirs==4.3.6 + # via + # black + # shandy-sqlfmt pyasn1==0.6.1 # via # pyasn1-modules @@ -84,19 +100,29 @@ ruamel-yaml==0.18.6 # via -r requirements/base.in ruamel-yaml-clib==0.2.8 # via ruamel-yaml +shandy-sqlfmt[jinjafmt]==0.21.2 + # via -r requirements/base.in six==1.16.0 # via # asttokens # kubernetes # python-dateutil +tomli==2.0.1 + # via + # black + # mypy + # shandy-sqlfmt toolz==0.12.1 # via pyseeyou +tqdm==4.66.5 + # via shandy-sqlfmt transifex-python==3.5.0 # via -r requirements/base.in tutor==18.1.3 # via -r requirements/base.in typing-extensions==4.12.2 # via + # black # mypy # tutor urllib3==2.2.3 diff --git a/requirements/dev.in b/requirements/dev.in index f8bc1917c..985b9c3dd 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -4,4 +4,3 @@ black pyinstaller pylint twine -shandy-sqlfmt[jinjafmt]==0.21.2 diff --git a/tutoraspects/patches/openedx-dev-dockerfile-post-python-requirements b/tutoraspects/patches/openedx-dev-dockerfile-post-python-requirements index 6ed1d1619..5805a44c5 100644 --- a/tutoraspects/patches/openedx-dev-dockerfile-post-python-requirements +++ b/tutoraspects/patches/openedx-dev-dockerfile-post-python-requirements @@ -1,5 +1,5 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ - pip install "platform-plugin-aspects==v0.11.0" + pip install "platform-plugin-aspects==v0.11.1" RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ pip install "edx-event-routing-backends>=9.3.0,<9.4" diff --git a/tutoraspects/patches/openedx-dockerfile-post-python-requirements b/tutoraspects/patches/openedx-dockerfile-post-python-requirements index 6ed1d1619..5805a44c5 100644 --- a/tutoraspects/patches/openedx-dockerfile-post-python-requirements +++ b/tutoraspects/patches/openedx-dockerfile-post-python-requirements @@ -1,5 +1,5 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ - pip install "platform-plugin-aspects==v0.11.0" + pip install "platform-plugin-aspects==v0.11.1" RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \ pip install "edx-event-routing-backends>=9.3.0,<9.4" diff --git a/tutoraspects/templates/aspects/apps/clickhouse/dev_config/server_config.xml b/tutoraspects/templates/aspects/apps/clickhouse/dev_config/server_config.xml index e9ae5da3d..9ce3223fe 100644 --- a/tutoraspects/templates/aspects/apps/clickhouse/dev_config/server_config.xml +++ b/tutoraspects/templates/aspects/apps/clickhouse/dev_config/server_config.xml @@ -2,7 +2,7 @@ {{patch("clickhouse-server-config")}} - information + debug 1 diff --git a/tutoraspects/templates/aspects/apps/superset/pythonpath/openedx_jinja_filters.py b/tutoraspects/templates/aspects/apps/superset/pythonpath/openedx_jinja_filters.py index 5394b6628..6e8b5f7cb 100644 --- a/tutoraspects/templates/aspects/apps/superset/pythonpath/openedx_jinja_filters.py +++ b/tutoraspects/templates/aspects/apps/superset/pythonpath/openedx_jinja_filters.py @@ -111,4 +111,30 @@ def translate_column_bool(column_name): """ +SQL_LINK_FORMAT = """ +concat('', + {column}, + '' +) +""" +def get_filtered_dashboard_link(dashboard_slug, column_name, filter_id): + """ + Creates a link to a dashboard with filters preloaded given a dashboard-slug, a column_name and a filter_id + """ + lang = security_manager.get_preferences(g.user.username) + + hlink = SQL_LINK_FORMAT.format(dashboard_slug=f"{dashboard_slug}-{lang}", column=column_name, filter_id=filter_id) + + return hlink + {{patch("superset-jinja-filters")}} diff --git a/tutoraspects/templates/aspects/apps/superset/pythonpath/superset_config_docker.py b/tutoraspects/templates/aspects/apps/superset/pythonpath/superset_config_docker.py index 4ba53b89a..8adcc2ddd 100644 --- a/tutoraspects/templates/aspects/apps/superset/pythonpath/superset_config_docker.py +++ b/tutoraspects/templates/aspects/apps/superset/pythonpath/superset_config_docker.py @@ -111,6 +111,7 @@ def can_view_courses_wrapper(*args, **kwargs): 'can_view_courses': can_view_courses_wrapper, 'translate_column': translate_column, 'translate_column_bool': translate_column_bool, + 'get_filtered_dashboard_link': get_filtered_dashboard_link, {% for filter in SUPERSET_EXTRA_JINJA_FILTERS %}'{{ filter }}': {{filter}},{% endfor %} }