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

[FC-0049] feat: Serialize tag data in OpenAssessmentBlocks #2171

Conversation

yusuf-musleh
Copy link
Contributor

TL;DR - This PR utilizes changes introduced in openedx/edx-platform#34145 to serialize and include tags data in OpenAssessmentBlocks

What changed?

  • The new serialize_tag_data is called and the result (if any) is added to the OLX node

Developer Checklist

Testing Instructions

Follow the testing instruction in openedx/edx-platform#34145 and make sure to setup ora2 locally on this branch, and include a few OpenAssessmentBlocks in the course and apply a few tags on it and then double check that tags-v1 is included in the OLX (if tags are applied to the block)

Reviewer Checklist

Collectively, these should be completed by reviewers of this PR:

  • I've done a visual code review
  • I've tested the new functionality

FYI: @openedx/content-aurora

@yusuf-musleh yusuf-musleh requested a review from a team as a code owner February 5, 2024 11:18
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 5, 2024
@openedx-webhooks
Copy link

Thanks for the pull request, @yusuf-musleh! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/serialize-tag-data-in-openassessment-olx branch 2 times, most recently from b9b410c to fb2b60f Compare February 5, 2024 12:29
Copy link

codecov bot commented Feb 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a255a08) 94.95% compared to head (c3e6ed5) 94.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2171   +/-   ##
=======================================
  Coverage   94.95%   94.95%           
=======================================
  Files         191      191           
  Lines       20675    20691   +16     
  Branches     1879     1880    +1     
=======================================
+ Hits        19631    19647   +16     
  Misses        780      780           
  Partials      264      264           
Flag Coverage Δ
unittests 94.95% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/serialize-tag-data-in-openassessment-olx branch 2 times, most recently from 8667fa7 to f0cd479 Compare February 5, 2024 13:53
@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/serialize-tag-data-in-openassessment-olx branch from f0cd479 to 5e9424c Compare February 6, 2024 14:06
@itsjeyd
Copy link

itsjeyd commented Feb 8, 2024

Hey @yusuf-musleh, this will need to go through internal review before we can mark it as ready for upstream review, right?

@yusuf-musleh
Copy link
Contributor Author

Hey @yusuf-musleh, this will need to go through internal review before we can mark it as ready for upstream review, right?

@itsjeyd Yup that's correct. Awaiting review/feedback from @ChrisChV and/or @bradenmacdonald first.

Comment on lines 776 to 779
if hasattr(oa_block, 'serialize_tag_data') and callable(oa_block.serialize_tag_data): # pylint: disable=no-member
tag_data = oa_block.serialize_tag_data() # pylint: disable=no-member
if tag_data:
root.set('tags-v1', tag_data)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that in TaggedBlockMixin you put these lines of code:

https://github.com/openedx/edx-platform/blob/2cd2f09da1a7cf1a609ca1309a35850458a166c7/cms/lib/xblock/tagging/tagged_block_mixin.py#L51-L54

into a helper function called add_tags_to_node. And then this can just become:

Suggested change
if hasattr(oa_block, 'serialize_tag_data') and callable(oa_block.serialize_tag_data): # pylint: disable=no-member
tag_data = oa_block.serialize_tag_data() # pylint: disable=no-member
if tag_data:
root.set('tags-v1', tag_data)
if hasattr(oa_block, 'add_tags_to_node') and callable(oa_block.add_tags_to_node): # pylint: disable=no-member
# This comes from TaggedBlockMixin
oa_block.add_tags_to_node(root) # pylint: disable=no-member

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, much cleaner. I've updated it, and also updated the edx-platform PR to use it as well.

@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/serialize-tag-data-in-openassessment-olx branch from 5e9424c to c16553c Compare February 12, 2024 09:18
@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/serialize-tag-data-in-openassessment-olx branch from c16553c to c3e6ed5 Compare February 12, 2024 09:24
@yusuf-musleh yusuf-musleh changed the title feat: Serialize tag data in OpenAssessmentBlocks [FC-0049] feat: Serialize tag data in OpenAssessmentBlocks Feb 12, 2024
Copy link

@ChrisChV ChrisChV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yusuf-musleh Looks good 👍

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

  • I tested this on my devstack by following the steps in the PR
  • I read through the code
  • I checked for accessibility issues N/A
  • Includes documentation N/A
  • User-facing strings are extracted for translation N/A

@pomegranited pomegranited merged commit 7c33111 into openedx:master Feb 13, 2024
9 checks passed
@openedx-webhooks
Copy link

@yusuf-musleh 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@pomegranited pomegranited deleted the yusuf-musleh/serialize-tag-data-in-openassessment-olx branch February 13, 2024 22:58
rpenido added a commit to open-craft/edx-ora2 that referenced this pull request Mar 1, 2024
pomegranited pushed a commit that referenced this pull request Mar 7, 2024
* Revert "feat: deserialize tag info from xml [FC-0049] (#2181)"

This reverts commit 5329fea.

* Revert "feat: Serialize tag data in OpenAssessmentBlocks (#2171)"

* test: improve coverage

* chore: bump version to 6.4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants