refactor: xblock api upstream info and course details api (#37971)
- Returns top parent key instead of boolean in upstream info api - Adds edited_on raw time in course outline api - Adds has_changes to course details api
This commit is contained in:
@@ -6,7 +6,7 @@ Consider moving these into opaque-keys if they generalize well.
|
||||
import hashlib
|
||||
from typing import NamedTuple, Self
|
||||
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
|
||||
|
||||
class BlockKey(NamedTuple):
|
||||
@@ -40,6 +40,12 @@ class BlockKey(NamedTuple):
|
||||
raise ValueError(f"Invalid string format for BlockKey: {s}")
|
||||
return cls(parts[0], parts[1])
|
||||
|
||||
def to_usage_key(self, course_key: CourseKey) -> UsageKey:
|
||||
"""
|
||||
Converts this BlockKey into a UsageKey.
|
||||
"""
|
||||
return course_key.make_usage_key(self.type, self.id)
|
||||
|
||||
|
||||
def derive_key(source: UsageKey, dest_parent: BlockKey) -> BlockKey:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user