Skip to content

Commit

Permalink
fix: untick locked worksheet ids (#2388)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos authored Dec 4, 2024
1 parent 8158b8a commit c07bd2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
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

0 comments on commit c07bd2e

Please sign in to comment.