Conversation
New `api/surveys` blueprint for post-event / live-event feedback, stored in a separate `surveys` Firestore collection (distinct from the peer-to-peer `feedback` collection). - GET /api/surveys/<event_id>/context (public) — mode (live/post/upcoming), caller's eligible roles, requires_captcha, already_submitted - POST /api/surveys/<event_id>/responses (public) — selected volunteers are trusted and skip CAPTCHA; nonprofits/anonymous must pass reCAPTCHA (reuses the contact form's verify_recaptcha) - GET /api/surveys/<event_id>/responses, /summary (volunteer.admin) Mode is timezone-aware off start/end_date. Eligible roles come from the volunteers collection (hacker on application; mentor/judge/volunteer/sponsor require isSelected). Logged-in responses upsert by event+mode+user. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A trusted (logged-in, isSelected) volunteer may now only submit feedback for a role they were actually selected for; everyone else is restricted to nonprofit. Added allowed_roles_for(), enforced in submit (403), and surfaced allowed_roles in the context response so the frontend can scope its role picker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- api/feedback/: read-only admin aggregation for /admin/feedback (peer + onboarding), volunteer.admin-gated, PII-light (drops IP, hides anonymous giver). - api/surveys: new GET /api/surveys/overview — one scan grouped by event_id with per-event rating/would_return averages, mode/role counts, hackathon metadata join. Powers the 'Compare events' view. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…veys Event feedback surveys API (surveys collection)
The /api/users/volunteering GET and POST both resolved identity and then
required a pre-existing Firestore user doc. Users who had authenticated but
never opened their profile page have no doc, so fetch_user_by_user_id returned
None -> 404 on both read and write. On /volunteer/track this surfaced as
"Failed to load your volunteer data" and also blocked them from starting a
session ("not working for some people").
- Add _resolve_and_ensure_user(): lazily creates the users doc when missing
(mirrors get_profile_metadata's save_user path).
- get_volunteering_time now returns ([], 0, 0) instead of None/404 so the page
shows a clean zero-state, and filters in a single pass (an entry may carry
commitmentHours, finalHours, or BOTH — no duplicate rows).
- save_volunteering_time accepts an optional timestamp (backdated manual logs)
and a manual:true flag; hours are float-cleaned, non-negative, capped.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…king Fix volunteer time tracking for users without a profile doc
| caller's eligible roles, and whether a CAPTCHA token is needed.""" | ||
| try: | ||
| result, status = get_survey_context(event_id, _propel_user_id()) | ||
| return jsonify(result), status |
| result, status = submit_survey_response( | ||
| event_id, _propel_user_id(), data, ip_address=request.remote_addr | ||
| ) | ||
| return jsonify(result), status |
| return jsonify(list_peer_feedback(_limit())), 200 | ||
| except Exception as e: | ||
| logger.exception("Error listing peer feedback: %s", str(e)) | ||
| return jsonify({"success": False, "error": str(e), "feedback": []}), 500 |
| return jsonify(list_onboarding_feedback(_limit())), 200 | ||
| except Exception as e: | ||
| logger.exception("Error listing onboarding feedback: %s", str(e)) | ||
| return jsonify({"success": False, "error": str(e), "onboarding_feedback": []}), 500 |
| return jsonify(get_event_survey_responses(event_id, request.args.get("mode"))), 200 | ||
| except Exception as e: | ||
| logger.exception("Error listing survey responses: %s", str(e)) | ||
| return jsonify({"success": False, "error": str(e), "responses": []}), 500 |
| return jsonify(get_event_survey_summary(event_id)), 200 | ||
| except Exception as e: | ||
| logger.exception("Error building survey summary: %s", str(e)) | ||
| return jsonify({"success": False, "error": str(e)}), 500 |
| return jsonify(get_cross_event_survey_overview()), 200 | ||
| except Exception as e: | ||
| logger.exception("Error building cross-event survey overview: %s", str(e)) | ||
| return jsonify({"success": False, "error": str(e), "events": []}), 500 |
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.
No description provided.