From 84060a5a509c19a7ad29e430fbc246969e959802 Mon Sep 17 00:00:00 2001 From: Bryann Valderrama Date: Tue, 6 Feb 2024 18:08:50 -0500 Subject: [PATCH] feat: add ora filter for submission step rendering chore: add openedx-filters in base requirements feat: move trigger of filter to add the context dict chore: use edues branch for openedx-filters package --- .../xblock/ui_mixins/legacy/views/submission.py | 9 +++++++++ requirements/base.in | 1 + requirements/base.txt | 7 +++++-- requirements/quality.txt | 9 ++++++--- requirements/test-acceptance.txt | 9 ++++++--- requirements/test.txt | 9 ++++++--- 6 files changed, 33 insertions(+), 11 deletions(-) diff --git a/openassessment/xblock/ui_mixins/legacy/views/submission.py b/openassessment/xblock/ui_mixins/legacy/views/submission.py index 8119502f64..e79df13dec 100644 --- a/openassessment/xblock/ui_mixins/legacy/views/submission.py +++ b/openassessment/xblock/ui_mixins/legacy/views/submission.py @@ -4,6 +4,7 @@ import logging from django.core.exceptions import ObjectDoesNotExist +from openedx_filters.learning.filters import ORASubmissionViewRenderStarted from xblock.exceptions import NoSuchServiceError from openassessment.xblock.utils.data_conversion import ( @@ -37,6 +38,14 @@ def render_submission(config, submission_info): context = get_submission_context(config, submission_info) path = get_submission_path(submission_info) + if path == "legacy/response/oa_response.html": + try: + # .. filter_implemented_name: ORASubmissionViewRenderStarted + # .. filter_type: org.openedx.learning.ora.submission_view.render.started.v1 + context, path = ORASubmissionViewRenderStarted.run_filter(context, path) + except ORASubmissionViewRenderStarted.RenderInvalidTemplate as exc: + context, path = exc.context, exc.template_name + return config.render_assessment(path, context_dict=context) diff --git a/requirements/base.in b/requirements/base.in index 72412fdfe8..bcd0274fe1 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -10,6 +10,7 @@ djangorestframework Xblock edx-opaque-keys openedx-events @ git+https://github.com/edunext/openedx-events.git@9.4.0/edues +openedx-filters @ git+https://github.com/edunext/openedx-filters.git@1.6.0/edues django django-simple-history diff --git a/requirements/base.txt b/requirements/base.txt index 3c154a0e2b..1c92049511 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -12,9 +12,9 @@ attrs==23.2.0 # via openedx-events bleach==6.1.0 # via -r requirements/base.in -boto3==1.34.35 +boto3==1.34.36 # via -r requirements/base.in -botocore==1.34.35 +botocore==1.34.36 # via # boto3 # s3transfer @@ -46,6 +46,7 @@ django==3.2.24 # edx-toggles # jsonfield # openedx-events + # openedx-filters django-crum==0.7.9 # via # edx-django-utils @@ -124,6 +125,8 @@ newrelic==9.6.0 # via edx-django-utils openedx-events @ git+https://github.com/edunext/openedx-events.git@9.4.0/edues # via -r requirements/base.in +openedx-filters @ git+https://github.com/edunext/openedx-filters.git@1.6.0/edues + # via -r requirements/base.in path==13.1.0 # via # -c requirements/constraints.txt diff --git a/requirements/quality.txt b/requirements/quality.txt index bdb339aec0..530bb92612 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -64,13 +64,13 @@ boto==2.49.0 # via # -r requirements/test.txt # moto -boto3==1.34.35 +boto3==1.34.36 # via # -r requirements/test.txt # aws-sam-translator # fs-s3fs # moto -botocore==1.34.35 +botocore==1.34.36 # via # -r requirements/test.txt # aws-xray-sdk @@ -184,6 +184,7 @@ django==3.2.24 # edx-toggles # jsonfield # openedx-events + # openedx-filters # xblock-sdk django-crum==0.7.9 # via @@ -239,7 +240,7 @@ exceptiongroup==1.2.0 # pytest factory-boy==3.3.0 # via -r requirements/test.txt -faker==22.7.0 +faker==23.1.0 # via # -r requirements/test.txt # factory-boy @@ -396,6 +397,8 @@ newrelic==9.6.0 # edx-django-utils openedx-events @ git+https://github.com/edunext/openedx-events.git@9.4.0/edues # via -r requirements/test.txt +openedx-filters @ git+https://github.com/edunext/openedx-filters.git@1.6.0/edues + # via -r requirements/test.txt packaging==23.2 # via # -r requirements/test.txt diff --git a/requirements/test-acceptance.txt b/requirements/test-acceptance.txt index 4a115efc7e..d0b0fa7e82 100644 --- a/requirements/test-acceptance.txt +++ b/requirements/test-acceptance.txt @@ -60,13 +60,13 @@ boto==2.49.0 # via # -r requirements/test.txt # moto -boto3==1.34.35 +boto3==1.34.36 # via # -r requirements/test.txt # aws-sam-translator # fs-s3fs # moto -botocore==1.34.35 +botocore==1.34.36 # via # -r requirements/test.txt # aws-xray-sdk @@ -174,6 +174,7 @@ django==3.2.24 # edx-toggles # jsonfield # openedx-events + # openedx-filters # xblock-sdk django-crum==0.7.9 # via @@ -227,7 +228,7 @@ exceptiongroup==1.2.0 # pytest factory-boy==3.3.0 # via -r requirements/test.txt -faker==22.7.0 +faker==23.1.0 # via # -r requirements/test.txt # factory-boy @@ -380,6 +381,8 @@ newrelic==9.6.0 # edx-django-utils openedx-events @ git+https://github.com/edunext/openedx-events.git@9.4.0/edues # via -r requirements/test.txt +openedx-filters @ git+https://github.com/edunext/openedx-filters.git@1.6.0/edues + # via -r requirements/test.txt packaging==23.2 # via # -r requirements/test.txt diff --git a/requirements/test.txt b/requirements/test.txt index 3b95909d92..c3fb31b5cb 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -42,13 +42,13 @@ bleach==6.1.0 # via -r requirements/base.txt boto==2.49.0 # via moto -boto3==1.34.35 +boto3==1.34.36 # via # -r requirements/base.txt # aws-sam-translator # fs-s3fs # moto -botocore==1.34.35 +botocore==1.34.36 # via # -r requirements/base.txt # aws-xray-sdk @@ -133,6 +133,7 @@ distlib==0.3.8 # edx-toggles # jsonfield # openedx-events + # openedx-filters # xblock-sdk django-crum==0.7.9 # via @@ -180,7 +181,7 @@ exceptiongroup==1.2.0 # via pytest factory-boy==3.3.0 # via -r requirements/test.in -faker==22.7.0 +faker==23.1.0 # via factory-boy fastavro==1.9.3 # via @@ -302,6 +303,8 @@ newrelic==9.6.0 # edx-django-utils openedx-events @ git+https://github.com/edunext/openedx-events.git@9.4.0/edues # via -r requirements/base.txt +openedx-filters @ git+https://github.com/edunext/openedx-filters.git@1.6.0/edues + # via -r requirements/base.txt packaging==23.2 # via # docker