units,lesson as standalone

This commit is contained in:
2026-07-10 11:44:46 +08:00
parent 86fba50b95
commit e1ffdab190
46 changed files with 1463 additions and 197 deletions
+12
View File
@@ -105,6 +105,16 @@ async function onPerfectQuiz(user_id, quiz_id) {
await grantAchievement(user_id, 'perfect_quiz_score', { quiz_id });
}
/** Call after a single task's requirements are all satisfied for a user */
async function onTaskCompleted(user_id, task_id, task_name = null) {
await grantAchievement(user_id, 'first_task_completed', { task_id, task_name });
}
/** Call after every task in a task list is complete for a user */
async function onTaskListCompleted(user_id, task_list_id, task_list_name = null) {
await grantAchievement(user_id, 'task_list_finisher', { task_list_id, task_list_name });
}
/** Call after profile is fully filled out */
async function onProfileCompleted(user_id) {
await grantAchievement(user_id, 'profile_completed');
@@ -151,6 +161,8 @@ module.exports = {
onPerfectQuiz,
onProfileCompleted,
onReferral,
onTaskCompleted,
onTaskListCompleted,
// Admin
adminGrantAchievement,