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

fix: untick locked worksheet ids #2388

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
6 changes: 3 additions & 3 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion portal/templates/portal/teach/teacher_edit_class.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
// Uncheck the checkboxes that correspond to the already-locked levels
$(document).ready(function(){
const lockedLevelsIds = {{ locked_levels }};
const lockedWorksheetIds = {{ locked_worksheet_ids }};

lockedLevelsIds.forEach(function(lockedLevelId) {
const selector = `[value="${lockedLevelId}"]`;
const selector = `[value="level:${lockedLevelId}"]`;
$(selector).click();
})
lockedWorksheetIds.forEach(function(lockedWorksheetId) {
const selector = `[value="worksheet:${lockedWorksheetId}"]`;
$(selector).click();
})
})
Expand Down
3 changes: 3 additions & 0 deletions portal/views/teacher/teach.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ def teacher_edit_class(request, access_code):
locked_levels = klass.locked_levels.all()
locked_levels_ids = [locked_level.id for locked_level in locked_levels]

locked_worksheet_ids = [worksheet.id for worksheet in klass.locked_worksheets.all()]

form = ClassEditForm(
initial={
"name": klass.name,
Expand Down Expand Up @@ -336,6 +338,7 @@ def teacher_edit_class(request, access_code):
"blockly_episodes": blockly_episodes,
"python_episodes": python_episodes,
"locked_levels": locked_levels_ids,
"locked_worksheet_ids": locked_worksheet_ids,
"class": klass,
"external_requests_message": external_requests_message,
},
Expand Down
Loading