Skip to content

Commit

Permalink
Merge branch 'programs-count' of https://github.com/hedyorg/hedy into…
Browse files Browse the repository at this point in the history
… programs-count
  • Loading branch information
Annelein committed Apr 17, 2024
2 parents 5785026 + 185c3dd commit dea21dd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions static/js/appbundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -99210,8 +99210,8 @@ def note_with_error(value, err):
is_debug: run_type === "debug",
tutorial: $("#code_output").hasClass("z-40"),
read_aloud: !!$("#speak_dropdown").val(),
adventure_name: adventure ? adventure.name : void 0,
short_name: adventure ? adventure.short_name : void 0,
adventure_name: adventureName,
raw,
program_id: isServerSaveInfo(adventure == null ? void 0 : adventure.save_info) ? adventure.save_info.id : void 0,
save_name: saveNameFromInput()
};
Expand Down Expand Up @@ -99362,6 +99362,14 @@ def note_with_error(value, err):
const response = await postJsonWithAchievements("/programs/delete", { id: id2 });
showAchievements(response.achievement, true, "");
$("#program_" + id2).remove();
let text = $("#program_count").text();
let match = text.match(/\d+/);
if (match) {
let currentNumber = parseInt(match[0]);
let newNumber = currentNumber - 1;
let newText = text.replace(/\d+/, newNumber.toString());
$("#program_count").text(newText);
}
modal.notifySuccess(response.message);
});
}
Expand Down Expand Up @@ -100298,8 +100306,7 @@ def note_with_error(value, err):
code,
adventure_name: adventureName,
program_id: saveInfo == null ? void 0 : saveInfo.id,
share: saveInfo == null ? void 0 : saveInfo.public,
short_name: adventure.short_name
share: saveInfo == null ? void 0 : saveInfo.public
});
adventure.editor_contents = code;
if (response.save_info) {
Expand Down
6 changes: 3 additions & 3 deletions static/js/appbundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion website/programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def store_user_program(self,
program_to_check = copy.deepcopy(program)
program_to_check['adventure_name'] = short_name
is_modified = self.statistics.is_program_modified(program_to_check, full_adventures, teacher_adventures)
# a program can be saved before but not yet modified,
# a program can be saved before but not yet modified,
# and if it was already modified and now is so again, count should not increase.
if is_modified and not program['is_modified']:
self.db.increase_user_program_count(user["username"])
Expand Down

0 comments on commit dea21dd

Please sign in to comment.