Skip to content

Commit 4c1a9f1

Browse files
committed
fix: deps backfill fails due to missing log_record
This migration used to use the current models, which have a "log_record" property in order to normalize things more between the Draft and Published models, but this is not present in the historical models that this migration was shifted to. This fix uses the current Published/Draft verisons where that was equivalent to checking the log records, and explicitly switches between draft_log_record and publish_log_record in the places where we need to. Increments version to 0.38.2
1 parent c997e66 commit 4c1a9f1

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/openedx_content/backcompat/publishing/migrations/0010_backfill_dependencies.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,23 @@ def hash_for_log_record(
400400
# Begin normal
401401
dependencies = sorted(
402402
record_ids_to_live_deps[record.id],
403-
key=lambda entity: getattr(entity, branch).log_record.new_version_id,
403+
key=lambda entity: getattr(entity, branch).version_id,
404404
)
405405
dep_state_entries = []
406406
for dep_entity in dependencies:
407-
new_version_id = getattr(dep_entity, branch).log_record.new_version_id
407+
new_version_id = getattr(dep_entity, branch).version_id
408+
409+
# Unfortunate inconsistency in field naming in the models. We have a
410+
# property to normalize this, but that doesn't apply to the historical
411+
# models.
412+
if branch == "draft":
413+
log_record = dep_entity.draft.draft_log_record
414+
else:
415+
log_record = dep_entity.published.publish_log_record
416+
408417
hash_digest = hash_for_log_record(
409418
apps,
410-
getattr(dep_entity, branch).log_record,
419+
log_record,
411420
record_ids_to_hash_digests,
412421
record_ids_to_live_deps,
413422
untrusted_record_id_set,

src/openedx_core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"""
77

88
# The version for the entire repository
9-
__version__ = "0.38.1"
9+
__version__ = "0.38.2"

0 commit comments

Comments
 (0)