Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make course optimizer scan only published version #35963

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading