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:
Navin Karkera
2026-02-10 04:39:06 +05:30
committed by GitHub
parent 3c4cf0e2d2
commit 8ca70db552
11 changed files with 52 additions and 20 deletions

View File

@@ -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:
"""