Skip to content

Survey, Feedback, Track Volunteer Hours bugfix#251

Merged
gregv merged 6 commits into
mainfrom
develop
Jun 30, 2026
Merged

Survey, Feedback, Track Volunteer Hours bugfix#251
gregv merged 6 commits into
mainfrom
develop

Conversation

@gregv

@gregv gregv commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

gregv and others added 6 commits June 27, 2026 22:31
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
@gregv
gregv merged commit 9b963aa into main Jun 30, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants