Pass PROLIFIC_PID through to the post-survey URL - #135
Conversation
The Qualtrics post-survey needs the participant's PROLIFIC_PID so the response can be matched back to the study. The tutorial finish screen already links to the workshop's surveyUrl; append `?PROLIFIC_PID=<pid>` (merged with any existing query string) when the workspace carries a captured Prolific PID, and pass the URL through untouched otherwise (participant didn't arrive via Prolific, or no survey configured). - withProlificPid() helper in lib/prolific.ts (URL-based merge; overwrites a stale key, encodes the value, no-ops on non-absolute/malformed URLs). - PatchLensArea reads the workspace's captured prolific.prolificPid and composes the surveyUrl handed to the finish-screen CTA. - Unit tests for parse + pass-through. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe patch lens retrieves the workspace’s Prolific participant ID and adds it to the tutorial survey URL. A new helper handles insertion, replacement, encoding, parameter preservation, and invalid input. Unit tests cover these cases. ChangesProlific participant ID flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PatchLensArea
participant WorkspaceQuery
participant withProlificPid
participant TutorialActivityPanel
PatchLensArea->>WorkspaceQuery: fetch workspace by workspaceId
WorkspaceQuery-->>PatchLensArea: return captured Prolific participant ID
PatchLensArea->>withProlificPid: add participant ID to survey URL
withProlificPid-->>PatchLensArea: return enriched survey URL
PatchLensArea->>TutorialActivityPanel: pass enriched survey URL
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
workbench/_web/src/app/workbench/[workspaceId]/patch-lens/[chartId]/components/PatchLensArea.tsx (1)
179-179: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse
async/awaitin the query function.Line 179 returns the promise from
getWorkspaceByIddirectly. Make the query functionasyncand await the call.Proposed fix
- queryFn: () => getWorkspaceById(workspaceId as string), + queryFn: async () => await getWorkspaceById(workspaceId as string),As per coding guidelines, “Always use async/await for promises in TypeScript code”.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@workbench/_web/src/app/workbench/`[workspaceId]/patch-lens/[chartId]/components/PatchLensArea.tsx at line 179, Update the queryFn callback in PatchLensArea to be async and await the getWorkspaceById(workspaceId as string) call, preserving the existing workspace query behavior.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@workbench/_web/src/app/workbench/`[workspaceId]/patch-lens/[chartId]/components/PatchLensArea.tsx:
- Line 179: Update the queryFn callback in PatchLensArea to be async and await
the getWorkspaceById(workspaceId as string) call, preserving the existing
workspace query behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: af904f3f-6dac-444b-b807-0683d3f058c5
📒 Files selected for processing (3)
workbench/_web/src/app/workbench/[workspaceId]/patch-lens/[chartId]/components/PatchLensArea.tsxworkbench/_web/src/lib/__tests__/prolific.test.tsworkbench/_web/src/lib/prolific.ts
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
🧹 Preview for PR #135 torn down. |
What
The Qualtrics post-survey needs the participant's
PROLIFIC_PIDso their response can be matched back to the study. The tutorial finish screen (CompletionCta) already links to the workshop'ssurveyUrl; this appends?PROLIFIC_PID=<pid>to that link when the workspace carries a captured Prolific PID.How
withProlificPid()helper inlib/prolific.ts— merges the PID into the survey URL via theURLAPI, so it:?PROLIFIC_PID=…to a bare URL,…?foo=bar&PROLIFIC_PID=…) rather than clobbering it,PROLIFIC_PIDinstead of duplicating it,PatchLensAreareads the workspace's capturedprolific.prolificPid(same query key already cached elsewhere) and composes thesurveyUrlhanded to the finish-screen CTA. Naturally gated:surveyUrlonly exists for workshops and the PID only exists for Prolific arrivals.parseProlificParamsandwithProlificPid.Testing
bun test→ 114/114 pass.tsc/prettier clean on changed files.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes