Skip to content
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

[WIP] feat: add ORA filter for student_view rendering intervention #2000

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions openassessment/xblock/openassessmentblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
from xblock.fields import Boolean, Integer, List, Scope, String
from web_fragments.fragment import Fragment

from openedx_filters.learning.filters import ORAStudentViewRenderStarted

from openassessment.staffgrader.staff_grader_mixin import StaffGraderMixin
from openassessment.workflow.errors import AssessmentWorkflowError
from openassessment.xblock.course_items_listing_mixin import CourseItemsListingMixin
Expand Down Expand Up @@ -540,14 +542,34 @@ def student_view(self, context=None): # pylint: disable=unused-argument
ui_models = self._create_ui_models()
# All data we intend to pass to the front end.
context_dict = {
"block": self,
"title": self.title,
"prompts": self.prompts,
"prompts_type": self.prompts_type,
"rubric_assessments": ui_models,
"show_staff_area": self.is_course_staff and not self.in_studio_preview,
}
template = get_template("openassessmentblock/oa_base.html")
return self._create_fragment(template, context_dict, initialize_js_func='OpenAssessmentBlock')
template_name = "openassessmentblock/oa_base.html"
try:
# .. filter_implemented_name: ORAStudentViewRenderStarted
# .. filter_type: org.openedx.learning.ora.student_view.render.started.v1
context_dict, template_name = ORAStudentViewRenderStarted.run_filter(
context_dict,
template_name,
)
except ORAStudentViewRenderStarted.RenderInvalidTemplate as exc:
context_dict, template_name = (exc.template_context, exc.template)
except ORAStudentViewRenderStarted.RenderCustomFragment as exc:
fragment = exc.fragment
else:
template = get_template(template_name)
fragment = self._create_fragment(
template,
context_dict,
initialize_js_func='OpenAssessmentBlock',
)

return fragment

def ora_blocks_listing_view(self, context=None):
"""This view is used in the Open Response Assessment tab in the LMS Instructor Dashboard
Expand Down
Loading