Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the activity management system by adding new activities, preventing duplicate sign-ups, and improving the UI for displaying participants.
- Added six new activities with relevant details in the backend
- Implemented duplicate sign-up validation in the signup function
- Updated the frontend and CSS for better presentation of participant details
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app.py | Added new activities and duplicate sign-up validation logic |
| src/static/app.js | Updated activity card to display a list of participant emails |
| src/static/styles.css | Added CSS styles for the new Participants section |
Comment on lines
+101
to
107
| # Validate student is not already signed up | ||
| if email in activity["participants"]: | ||
| raise HTTPException(status_code=400, detail="Already signed up for this activity") | ||
|
|
||
| # Add student | ||
| activity["participants"].append(email) | ||
| return {"message": f"Signed up {email} for {activity_name}"} |
There was a problem hiding this comment.
Consider normalizing email addresses (e.g., converting them to lowercase) before checking for duplicates to ensure consistency.
Suggested change
| # Validate student is not already signed up | |
| if email in activity["participants"]: | |
| raise HTTPException(status_code=400, detail="Already signed up for this activity") | |
| # Add student | |
| activity["participants"].append(email) | |
| return {"message": f"Signed up {email} for {activity_name}"} | |
| # Normalize email to lowercase | |
| normalized_email = email.lower() | |
| # Validate student is not already signed up | |
| if normalized_email in activity["participants"]: | |
| raise HTTPException(status_code=400, detail="Already signed up for this activity") | |
| # Add student | |
| activity["participants"].append(normalized_email) | |
| return {"message": f"Signed up {normalized_email} for {activity_name}"} |
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 activity management system, including the addition of new activities, validation for duplicate sign-ups, and UI improvements to display participant details. Below are the key changes grouped by theme:
Backend Enhancements:
Soccer Team,Basketball Team,Art Club,Drama Club,Math Club, andDebate Team) to theactivitiesdictionary, each with a description, schedule, maximum participants, and initial participants. (src/app.py, src/app.pyR41-R76)signup_for_activityfunction to prevent duplicate sign-ups by checking if the user is already in the participants list. If so, anHTTPExceptionwith a 400 status code is raised. (src/app.py, src/app.pyR101-R104)Frontend Enhancements:
Participantssection. (src/static/app.js, src/static/app.jsR28-R33)Styling Improvements:
Participantssection, including a styled container with a light blue background, rounded borders, and customized text colors for better readability. (src/static/styles.css, src/static/styles.cssR145-R169)