Skip to content

Commit

Permalink
Merge pull request #31 from openedx/iahmad/ENT-8458
Browse files Browse the repository at this point in the history
feat: Verification pipeline filter not run for proctored exam units
  • Loading branch information
irfanuddinahmad authored Mar 15, 2024
2 parents e650d68 + 5183f42 commit 9ed2992
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Unreleased
**********

*
[0.1.8] - 2024-03-14
************************************************

Changed
=======

* Verification pipeline filter not run for proctored exam units


[0.1.7] - 2024-01-31
************************************************
Expand Down
2 changes: 1 addition & 1 deletion skill_tagging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Django app plugin for fetching and verifying tags for xblock skills.
"""

__version__ = '0.1.7'
__version__ = '0.1.8'

# pylint: disable=invalid-name
default_app_config = 'skill_tagging.apps.SkillTaggingConfig'
17 changes: 14 additions & 3 deletions skill_tagging/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
from django.template import Context, Template
from openedx_filters import PipelineStep

try:
from edx_proctoring.models import ProctoredExam
except ImportError:
ProctoredExam = None

logger = logging.getLogger(__name__)
DEFAULT_PROBABILITY = 0.03

Expand All @@ -35,6 +40,13 @@ def fetch_related_skills(block):
tags = fetch_tags()
return tags

@staticmethod
def is_proctored_exam(content_id):
"""Determines whether the content is a proctored exam."""
if ProctoredExam:
return ProctoredExam.objects.filter(content_id=content_id, is_proctored=True).exists()
return False

@staticmethod
def should_run_filter():
"""Determines whether we should run filter and display form."""
Expand Down Expand Up @@ -81,14 +93,13 @@ class AddVerticalBlockSkillVerificationSection(VerificationPipelineBase, Pipelin
"""
def run_filter(self, block, fragment, context, view): # pylint: disable=arguments-differ
"""Pipeline Step implementing the Filter"""

usage_id = block.scope_ids.usage_id
# Check whether we need to run this filter and only call the API.
if not self.should_run_filter():
if not self.should_run_filter() or self.is_proctored_exam(str(usage_id)):
return {"block": block, "fragment": fragment, "context": context, "view": view}
skills = self.fetch_related_skills(block)
if not skills:
return {"block": block, "fragment": fragment, "context": context, "view": view}
usage_id = block.scope_ids.usage_id
data = self.get_skill_context(usage_id, block, skills)
html = resource_string("static/tagging.html")
css = resource_string("static/tagging.css")
Expand Down

0 comments on commit 9ed2992

Please sign in to comment.