Improve student activity registration system - #2
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request enhances the FastAPI-based student activities application by expanding available activities, adding participant unregister support, improving the UI to manage participants, and adding automated tests and documentation updates.
Changes:
- Added new activities and prevented duplicate signups on the
/activities/{activity_name}/signupendpoint. - Introduced a DELETE endpoint to unregister a participant (
/activities/{activity_name}/participants) and updated the frontend to support “unregister” actions. - Added a pytest suite (with isolation fixture) and updated docs/dependencies to support running tests.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/app.py |
Adds new activities, duplicate-signup protection, and a participant-unregister endpoint. |
src/static/app.js |
Renders participants (sorted) with per-participant unregister buttons and wires DELETE requests + UI refresh. |
src/static/styles.css |
Styles the new participants section and unregister button. |
tests/test_app.py |
Adds API tests for redirect, listing activities, signup, duplicate prevention, and unregister behavior. |
tests/conftest.py |
Provides a TestClient fixture and resets in-memory activities state between tests. |
src/README.md |
Updates install instructions to use requirements.txt and adds how to run tests. |
requirements.txt |
Adds pytest dependency for the new test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+23
to
+44
| const sortedParticipants = [...details.participants].sort((a, b) => | ||
| a.localeCompare(b, undefined, { sensitivity: "base" }) | ||
| ); | ||
| const participantsList = sortedParticipants | ||
| .map( | ||
| (participant) => ` | ||
| <li class="participant-item"> | ||
| <span class="participant-email">${participant}</span> | ||
| <button | ||
| type="button" | ||
| class="participant-delete" | ||
| data-activity="${name}" | ||
| data-email="${participant}" | ||
| aria-label="Unregister ${participant} from ${name}" | ||
| title="Unregister participant" | ||
| > | ||
| <span aria-hidden="true">🗑</span> | ||
| </button> | ||
| </li> | ||
| ` | ||
| ) | ||
| .join(""); |
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.
This pull request introduces several new features and improvements to the FastAPI student activities app, focusing on participant management, UI enhancements, and automated testing. The most important changes are grouped below by theme.
Backend: Activity and Participant Management
activitiesdata structure inapp.py./activities/{activity_name}/participantsto allow unregistering a student from an activity, including validation and error handling.Frontend: User Interface and Experience
Testing and Documentation
test_app.py) covering all main API endpoints and edge cases, including signup, unregister, and error conditions.conftest.pyfixture to ensure test isolation by resetting the activities state before each test.README.mdto instruct users to install dependencies viarequirements.txtand added a section on how to run tests with pytest. [1] [2]