Repository navigation
Add registration validation and more activities - #2
Conversation
…ription des participants
…tivité et styles associés
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the activity management system by adding new activities, implementing duplicate registration prevention, and displaying participant lists on the frontend. The changes improve both user experience and data integrity by preventing duplicate signups and providing better visibility into activity participation.
- Added six new activities across sports, artistic, and intellectual categories with predefined participants
- Implemented backend validation to prevent duplicate registrations for the same activity
- Enhanced the frontend to display participant lists for each activity with styling
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/app.py | Added new activities and duplicate registration validation logic |
| src/static/app.js | Updated UI to display participant lists for each activity |
| src/static/styles.css | Added CSS styling for the new participant list display |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| <h5>Participants</h5> | ||
| <ul> | ||
| ${details.participants.length === 0 | ||
| ? '<li><em>Aucun participant pour le moment</em></li>' |
There was a problem hiding this comment.
The text 'Aucun participant pour le moment' is in French, which appears inconsistent with the rest of the application that uses English. Consider changing to 'No participants yet' for consistency.
| ? '<li><em>Aucun participant pour le moment</em></li>' | |
| ? '<li><em>No participants yet</em></li>' |
|
|
||
| # Check if already signed up | ||
| if email in activity["participants"]: | ||
| raise HTTPException(status_code=400, detail="Already signed up for this activity") |
There was a problem hiding this comment.
There's trailing whitespace at the end of this line. Consider removing it for cleaner code formatting.
| raise HTTPException(status_code=400, detail="Already signed up for this activity") | |
| raise HTTPException(status_code=400, detail="Already signed up for this activity") |
This pull request adds several new activities to the system, improves the signup logic to prevent duplicate registrations, and enhances the user interface by displaying participant lists for each activity. The changes are organized into backend data/model updates, backend logic improvements, and frontend display enhancements.
Backend data/model updates:
activitiesdictionary insrc/app.py, including sports (Soccer Team, Basketball Club), artistic (Art Workshop, Drama Club), and intellectual (Mathletes, Science Club) activities, each with their own schedule, participant list, and maximum capacity.Backend logic improvements:
signup_for_activityfunction insrc/app.pyto prevent users from signing up for the same activity more than once by checking if the email is already in the participant list and raising an error if so.Frontend display enhancements:
src/static/app.jsto show a list of participants for each activity card, including a message when there are no participants yet.src/static/styles.cssto visually enhance the participant list section in activity cards, including spacing, colors, and hover effects.