Skip to content

Commit

Permalink
feat: make course optimizer scan only published version
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperhodge committed Dec 4, 2024
1 parent 927b8c0 commit d9a3754
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def post(self, request: Request, course_id: str):
if not has_studio_read_access(request.user, course_key):
self.permission_denied(request)

check_broken_links.delay(request.user.id, course_key_string, request.LANGUAGE_CODE)
check_broken_links.delay(request.user.id, course_id, request.LANGUAGE_CODE)
return JsonResponse({'LinkCheckStatus': UserTaskStatus.PENDING})


Expand Down Expand Up @@ -180,8 +180,10 @@ def get(self, request: Request, course_id: str):
except ValueError:
# Wasn't JSON, just use the value as a string
pass

# print('DTO')
# print(broken_links_dto)

# mock dto for testing
# broken_links_dto = {
# 'sections': [
Expand Down
5 changes: 3 additions & 2 deletions cms/djangoapps/contentstore/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ def scan_course(course_key):
[<block_id>, <broken_link>]
"""
broken_links = []
verticals = modulestore().get_items(course_key, qualifiers={'category': 'vertical'})
verticals = modulestore().get_items(course_key, qualifiers={'category': 'vertical'}, revision=ModuleStoreEnum.RevisionOption.published_only)
print('verticals: ', verticals)
blocks = []

for vertical in verticals:
Expand All @@ -1187,7 +1188,7 @@ def scan_course(course_key):
broken_links.append([str(usage_key), url])

return broken_links

user = validate_user()

self.status.set_state('Scanning')
Expand Down

0 comments on commit d9a3754

Please sign in to comment.