Improve student activity registration system#2
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the student activities system by expanding the in-memory activity catalog, preventing duplicate signups, adding participant removal support end-to-end (API + UI), and introducing pytest coverage to validate the new behaviors.
Changes:
- Expanded the
activitiesdataset and added backend logic for duplicate signup prevention plus a new participant-removal endpoint. - Updated the frontend to render participants per activity and allow removing participants via a delete button.
- Added pytest fixtures and tests to ensure isolation and cover GET, signup (including duplicates), and removal flows.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/app.py |
Adds new activities, prevents duplicate signups, and introduces DELETE /activities/{activity_name}/participants. |
src/static/app.js |
Renders participants and wires up delete-participant behavior; refreshes UI after signup/removal. |
src/static/styles.css |
Adds styling for participant lists and delete buttons. |
tests/conftest.py |
Introduces a fixture that snapshots/restores the in-memory activities dict per test. |
tests/test_activities.py |
Adds tests for activity retrieval, successful/duplicate signup, and participant removal scenarios. |
requirements.txt |
Adds test/dependency entries needed for running the new test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 enhancements to the activities management system, focusing on expanding available activities, improving participant management (including the ability to remove participants), updating the frontend to reflect these changes, and adding comprehensive tests. These changes collectively improve both user experience and code reliability.
Backend enhancements:
activitiesdata structure insrc/app.py, each with its own description, schedule, participant capacity, and initial participants.DELETE /activities/{activity_name}/participants) to allow removal of a participant from an activity, with appropriate error handling if the participant or activity does not exist. Also added a check to prevent duplicate signups in the signup endpoint.Frontend improvements:
src/static/app.jsto display participants for each activity, including a delete button next to each participant for easy removal. The participants list is now styled for clarity, and activity selection is reset on refresh to avoid duplicate options. [1] [2]Testing and code quality:
tests/conftest.pyto ensure the in-memory activities data is restored after each test, maintaining test isolation.tests/test_activities.pyto cover activity retrieval, successful and duplicate signups, and participant removal (both successful and not found scenarios).