Add survey creation, submission, results analytics and response management#78
Conversation
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughChangesSurveys feature
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Browser
participant Worker
participant Database
Browser->>Worker: Request survey list or detail
Worker->>Database: Query survey data and submission status
Database-->>Worker: Survey records
Worker-->>Browser: JSON survey data
Browser->>Worker: Submit survey answers
Worker->>Database: Validate and persist response
Database-->>Worker: Stored response
Worker-->>Browser: Submission response
Browser->>Worker: Request survey results
Worker->>Database: Aggregate responses and answers
Database-->>Worker: Result statistics
Worker-->>Browser: JSON results
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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.
Actionable comments posted: 4
🤖 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.
Inline comments:
In `@public/surveys.html`:
- Around line 395-405: Update the CSV construction in the export-data click
handler to sanitize user-authored res.text and label values before quoting them:
prefix any cell whose content begins with =, +, -, or @ so spreadsheet
applications treat it as text. Apply the same sanitizer to both fields while
preserving existing quote escaping and CSV output behavior.
- Around line 139-149: Add aria-label attributes describing the purpose of the
question type select and question-text input in the question-rendering template.
Update the controls identified by data-field="type" and data-field="text" while
preserving their existing values, styling, and behavior.
In `@src/worker.py`:
- Around line 3206-3236: The api_survey_results handler currently exposes
decrypted text answers without authentication. Update api_survey_results to
reuse the existing verify_token authentication guard, and only include raw text
answers when the authenticated user is the survey creator; otherwise remove
text_answers from the response payload.
- Around line 3147-3156: The survey submission writes at src/worker.py lines
3147-3156 must be made atomic: in api_submit_survey, precompute encrypted text
values, build the response and survey_answers statements, and execute them
through env.DB.batch(...). Also batch the surveys, survey_questions, and
survey_choices inserts at src/worker.py lines 3013-3025 so survey creation
cannot partially persist.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: alphaonelabs/coderabbit/.coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 62e22da1-6e67-4985-8755-aee908dc61d2
📒 Files selected for processing (2)
public/surveys.htmlsrc/worker.py
This PR implements a complete Survey System, including survey creation, participation, response collection, and analytics.
Backend
Implemented API endpoints:
Survey Management
Survey Participation
Survey Analytics
Features
Support for multiple question types:
Required question validation
Duplicate submission prevention (409 response)
Creator-only survey deletion
Survey response aggregation
Response rate calculation
Engagement score calculation
Top and bottom choice insights
Security
Frontend
Rebuilt
public/surveys.htmlas a self-contained page supporting:/surveys)?create=1)?id=<survey_id>)?id=<survey_id>&results=1)Screenshot:
Screencast.from.2026-07-19.21-12-48.mp4
Summary
Impact
Users can now create and complete surveys, while creators can review aggregated results through a dedicated interface. Survey response privacy is improved through AES encryption of free-text answers.