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

Allow SGA blocks to be used in Libraries v2 context [FC-0076] #363

Merged
merged 4 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion edx_sga/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Module for StaffGradedAssignmentXBlock.
"""

__version__ = "0.25.0"
__version__ = "0.25.1"
17 changes: 12 additions & 5 deletions edx_sga/sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,10 @@ def block_id(self):
def block_course_id(self):
"""
Return the course_id of the block.

Note: if this block is used in a Content Library, the returned ID will be the library's ID.
"""
return str(self.course_id)
return str(self.context_key)

def get_student_item_dict(self, student_id=None):
"""
Expand Down Expand Up @@ -698,13 +700,18 @@ def update_staff_debug_context(self, context):
"""
Add context info for the Staff Debug interface.
"""
published = self.start
published = getattr(self, 'start', None)
context["is_released"] = published and published < utcnow()
context["location"] = self.location
context["category"] = type(self).__name__
context["fields"] = [
(name, field.read_from(self)) for name, field in self.fields.items()
]
context["fields"] = []

for name, field in self.fields.items():
try:
context["fields"].append((name, field.read_from(self)))
# Library blocks only support the content and settings scopes
except NotImplementedError:
pass

def get_student_module(self, module_id):
"""
Expand Down
Loading