Skip to content

Commit

Permalink
tests: indentation linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ormsbee committed Aug 14, 2024
1 parent 3e55345 commit 624acce
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions openedx_learning/apps/authoring/publishing/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,26 +245,27 @@ def publish_all_drafts(
"""
Publish everything that is a Draft and is not already published.
"""
draft_qset = Draft.objects \
.select_related("entity__published") \
.filter(entity__learning_package_id=learning_package_id) \
.exclude(
# Exclude entities where the Published version already
# matches the Draft version.
entity__published__version_id=F("version_id")
) \
.exclude(
# Account for soft-deletes:
# NULL != NULL in SQL, so simply excluding entities
# where the Draft and Published versions match will
# not catch the case where a soft-delete has been
# published (i.e. both the Draft and Published
# versions are NULL). We need to explicitly check for
# that case instead, or else we will re-publish
# the same soft-deletes over and over again.
Q(version__isnull=True) &
Q(entity__published__version__isnull=True)
)
draft_qset = (
Draft.objects
.select_related("entity__published")
.filter(entity__learning_package_id=learning_package_id)
.exclude(
# Exclude entities where the Published version already
# matches the Draft version.
entity__published__version_id=F("version_id")
)
.exclude(
# Account for soft-deletes:
# NULL != NULL in SQL, so simply excluding entities
# where the Draft and Published versions match will
# not catch the case where a soft-delete has been
# published (i.e. both the Draft and Published
# versions are NULL). We need to explicitly check for
# that case instead, or else we will re-publish
# the same soft-deletes over and over again.
Q(version__isnull=True) & Q(entity__published__version__isnull=True)
)
)

return publish_from_drafts(
learning_package_id, draft_qset, message, published_at, published_by
Expand Down

0 comments on commit 624acce

Please sign in to comment.