Skip to content

Commit

Permalink
Merge pull request #25 from openedx/iahmad/ENT-8117
Browse files Browse the repository at this point in the history
feat: added debug logs for skill tagging filter
  • Loading branch information
irfanuddinahmad authored Jan 24, 2024
2 parents 436d3cd + f007048 commit cdd89a9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Unreleased

*

[0.1.4] - 2024-01-22
************************************************

Changed
=======

* Added debug logs for filter runs


[0.1.3] - 2023-09-27
************************************************

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.3'
__version__ = '0.1.4'

# pylint: disable=invalid-name
default_app_config = 'skill_tagging.apps.SkillTaggingConfig'
16 changes: 16 additions & 0 deletions skill_tagging/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,17 @@ def run_filter(self, block, fragment, context, view): # pylint: disable=argumen
# Check whether we need to run this filter and only call the API.
if not self.should_run_filter():
return {"block": block, "fragment": fragment, "context": context, "view": view}
logger.info(
"[Xblock-Skill-Tagging] Filter run for AddVerticalBlockSkillVerificationSection. Block-ID: %s",
str(block.scope_ids.usage_id.block_id)
)
skills = self.fetch_related_skills(block)
if not skills:
return {"block": block, "fragment": fragment, "context": context, "view": view}
logger.info(
"[Xblock-Skill-Tagging] Skills found for AddVerticalBlockSkillVerificationSection. Block-ID: %s",
str(block.scope_ids.usage_id.block_id)
)
usage_id = block.scope_ids.usage_id
data = self.get_skill_context(usage_id, block, skills)
html = resource_string("static/tagging.html")
Expand Down Expand Up @@ -122,9 +130,17 @@ def run_filter(self, block, context): # pylint: disable=arguments-differ
if usage_id.block_type != "video" or not self.should_run_filter():
# avoid fetching skills for other xblocks
return {"block": block, "context": context}
logger.info(
"[Xblock-Skill-Tagging] Filter run for AddVideoBlockSkillVerificationComponent. Block-ID: %s",
str(block.scope_ids.usage_id.block_id)
)
skills = self.fetch_related_skills(block)
if not skills:
return {"block": block, "context": context}
logger.info(
"[Xblock-Skill-Tagging] Skills found for AddVideoBlockSkillVerificationComponent. Block-ID: %s",
str(block.scope_ids.usage_id.block_id)
)
data = self.get_skill_context(usage_id, block, skills)

def wrapper(fn):
Expand Down

0 comments on commit cdd89a9

Please sign in to comment.