Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires badge awarding and activity completion into the real lesson and puzzle completion paths. Until now,
checkAndAwardhad no caller outsidee2e/seed.ts, and the?taskId=deep link emitted byActivitiesModal.tsxwas read nowhere. A student who finishes a lesson or puzzle now triggers a badge check and, when they arrived via an activity deep link, marks that daily activity complete.Type of Change
Key Changes
core/services/activitiesApi.ts: AddedgetActivityNameByTaskId(username, token, taskId). The deep link carries the catalogtaskId, butPUT /activities/:username/activitymatches onactivities.name, so this resolves one to the other. Also fixed the stale@paramdocstring oncompleteActivity.Puzzles.tsx: Reads?taskId=viauseSearchParams. In the puzzle-completed branch ofhandlePlayerMove, callscompleteActivity(when ataskIdis present) andcheckAndAward. Guarded withrole === "student"so a mentor in a shared session doesn't trigger these under their own username.Lesson-overlay.tsx: InhandleVPopup, right afterupdateCompletion(), resolves the username viaSetPermissionLevel, then callscompleteActivity(when?taskId=is present) andcheckAndAward..catchlogging, so a failed badge or activity call never blocks the success popup.Testing
Bugs Fixed (if applicable)
?taskId=deep link emitted byActivitiesModal.tsxwas never consumed, so daily activities could not be completed through the UI.checkAndAward.TODO (Follow-up Work)
updateCompletion()on a separate path and are not wired to these calls yet. Decide whether they should count.utils/studentStats.js:76-92androutes/streak.js:83-99: ticket filed, link below. Should be fixed before any badge is awarded on a streak threshold.Additional Notes
middlewarenodecontainer fails to start with a missingindexKeyconfig value, which is unrelated to this change. Please verify on a working environment, or I'll update this PR once my local setup is fixed.npx tsc --noEmit,CI=true npm test -- --watchAll=false).