fix: in generate_block_key, get the usage key's block_id, not usage_id

UsageKeys don't have a usage_id field. This line would have crashed
if run.
This commit is contained in:
Kyle D. McCormick
2024-01-16 09:13:17 -05:00
committed by Kyle McCormick
parent e8b60aef60
commit ef0fc97a2d

View File

@@ -102,7 +102,7 @@ def _import_block(store, user_id, source_block, dest_parent_key):
branch='library'
)
derived_block_key = derive_key(
source=source_key_as_v1_course_key.make_usage_key(source_key.block_type, source_key.usage_id),
source=source_key_as_v1_course_key.make_usage_key(source_key.block_type, source_key.block_id),
dest_parent=BlockKey(dest_parent_key.block_type, dest_parent_key.block_id),
)
return dest_parent_key.context_key.make_usage_key(*derived_block_key)