Improve student activity registration system - #2
Conversation
There was a problem hiding this comment.
Pull request overview
Adds unregister support for student activity signups end-to-end (backend API + frontend UI) and introduces backend tests to cover core signup/unregister flows.
Changes:
- Backend: add
DELETE /activities/{activity_name}/signupand prevent duplicate signups. - Frontend: render participant lists per activity and allow unregistering via a delete button; refresh UI after changes.
- Testing/data: add pytest suite for activities endpoints and expand seeded activities.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/app.py |
Adds unregister endpoint, duplicate-signup validation, and expands seeded activities. |
src/static/app.js |
Renders participants + unregister buttons and triggers refresh after signup/unregister. |
src/static/styles.css |
Styles participant list and delete/unregister button. |
tests/test_app.py |
Adds pytest coverage for listing, signup, duplicate signup, and unregister scenarios with isolation. |
requirements.txt |
Adds pytest dependency and fixes line formatting for watchfiles. |
tests/__init__.py |
Marks tests as a package (no functional changes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (response.ok) { | ||
| messageDiv.textContent = result.message; | ||
| messageDiv.className = "success"; | ||
| signupForm.reset(); | ||
| fetchActivities(); | ||
| } else { |
There was a problem hiding this comment.
fetchActivities() repopulates the <select id="activity"> by appending options but never clears existing options. Now that fetchActivities() is called after signup/unregister, the dropdown will accumulate duplicate activity options on every refresh. Clear/reset the select (preserving the placeholder option) before appending new options, or rebuild options from scratch each fetch.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request adds support for unregistering students from activities, improves the display of participants in the UI, and introduces comprehensive backend tests to ensure the reliability of signup and unregister features. It also expands the list of available activities.
Backend functionality and validation:
DELETE /activities/{activity_name}/signupendpoint to allow students to unregister from activities, with appropriate error handling for missing activities or students not registered.Frontend UI improvements:
Testing:
tests/test_app.py) covering activity listing, signup, and unregister endpoints, including edge cases and isolation between tests.Data updates: