Skip to content

Commit b190d51

Browse files
authored
Merge pull request #2915 from MisRob/mark-incomplete-fix
Fix mark incomplete command for topics
2 parents f042992 + 6313a98 commit b190d51

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

contentcuration/contentcuration/management/commands/mark_incomplete.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,33 @@ def handle(self, *args, **options):
3131
# Mark invalid licenses
3232
licensestart = time.time()
3333
logging.info('Marking blank licenses...')
34-
count = ContentNode.objects.exclude(complete=False, kind_id=content_kinds.TOPIC).filter(license__isnull=True).order_by().update(complete=False)
34+
count = ContentNode.objects.exclude(kind_id=content_kinds.TOPIC) \
35+
.exclude(complete=False) \
36+
.filter(license__isnull=True) \
37+
.order_by() \
38+
.update(complete=False)
3539
logging.info('Marked {} invalid licenses (finished in {})'.format(count, time.time() - licensestart))
3640

3741
licensestart = time.time()
3842
logging.info('Marking blank license descriptions...')
3943
custom_licenses = list(License.objects.filter(is_custom=True).values_list("pk", flat=True))
40-
count = ContentNode.objects.exclude(complete=False, kind_id=content_kinds.TOPIC)\
41-
.filter(license_id__in=custom_licenses).filter(Q(license_description__isnull=True) | Q(license_description=''))\
42-
.order_by().update(complete=False)
44+
count = ContentNode.objects.exclude(kind_id=content_kinds.TOPIC) \
45+
.exclude(complete=False) \
46+
.filter(license_id__in=custom_licenses) \
47+
.filter(Q(license_description__isnull=True) | Q(license_description='')) \
48+
.order_by() \
49+
.update(complete=False)
4350
logging.info('Marked {} invalid license descriptions (finished in {})'.format(count, time.time() - licensestart))
4451

4552
licensestart = time.time()
4653
logging.info('Marking blank copyright holders...')
4754
copyright_licenses = list(License.objects.filter(copyright_holder_required=True).values_list("pk", flat=True))
48-
count = ContentNode.objects.exclude(complete=False, kind_id=content_kinds.TOPIC)\
49-
.filter(license_id__in=copyright_licenses).filter(Q(copyright_holder__isnull=True) | Q(copyright_holder=''))\
50-
.order_by().update(complete=False)
55+
count = ContentNode.objects.exclude(kind_id=content_kinds.TOPIC) \
56+
.exclude(complete=False) \
57+
.filter(license_id__in=copyright_licenses) \
58+
.filter(Q(copyright_holder__isnull=True) | Q(copyright_holder=''))\
59+
.order_by() \
60+
.update(complete=False)
5161
logging.info('Marked {} invalid copyright holders (finished in {})'.format(count, time.time() - licensestart))
5262

5363
# Mark invalid file resources

0 commit comments

Comments
 (0)