Improve student activity registration system#2
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the activity signup app with unregister support, participant management in the UI, and a new backend test suite to validate core API behavior.
Changes:
- Added a
DELETE /activities/{activity_name}/signupendpoint and duplicate-signup prevention in the FastAPI backend. - Updated the frontend to render participants per activity and allow unregistering via per-participant UI controls, with improved messaging and refresh behavior.
- Introduced backend API tests and added
pytestto dependencies.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/app.py |
Adds new activities, prevents duplicate registrations, and introduces an unregister endpoint. |
src/static/app.js |
Renders participants with unregister buttons; adds reusable message UI and refreshes activity data after mutations. |
src/static/styles.css |
Adds styling for the participants section and delete controls. |
tests/test_app.py |
Adds API tests for listing activities, signup, unregister, and key error cases with state isolation. |
requirements.txt |
Adds pytest to support the new test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+7
to
+16
| function showMessage(text, type) { | ||
| messageDiv.textContent = text; | ||
| messageDiv.className = type; | ||
| messageDiv.classList.remove("hidden"); | ||
|
|
||
| // Hide message after 5 seconds | ||
| setTimeout(() => { | ||
| messageDiv.classList.add("hidden"); | ||
| }, 5000); | ||
| } |
Comment on lines
+35
to
+43
| const participantsMarkup = | ||
| details.participants.length > 0 | ||
| ? `<ul class="participants-list">${details.participants | ||
| .map( | ||
| (participant) => | ||
| `<li><span class="participant-email">${participant}</span><button type="button" class="participant-delete" data-activity="${encodeURIComponent(name)}" data-email="${encodeURIComponent(participant)}" aria-label="Unregister ${participant}" title="Unregister participant">x</button></li>` | ||
| ) | ||
| .join("")}</ul>` | ||
| : '<p class="participants-empty">No participants yet.</p>'; |
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 multiple improvements and new features to the activity signup application, focusing on expanding backend functionality, enhancing the frontend user experience, and increasing code reliability through testing. The most significant changes are the addition of unregister functionality for activities, improved participant management in the UI, and the introduction of comprehensive backend tests.
Backend enhancements:
DELETE /activities/{activity_name}/signupendpoint, including validation to ensure students are only removed if currently signed up.activitiesdata structure.Frontend improvements:
Styling and user experience:
Testing and reliability: