Add registration validation and more activities#2
Merged
sofiar-msft merged 3 commits intomainfrom Jun 23, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR expands the set of activities, adds a check to prevent duplicate signups, and updates the UI to list participants with accompanying styles.
- Introduces sports, artistic, and intellectual activities in the backend
- Adds signup validation to reject duplicate participant registrations
- Enhances frontend cards to display participant lists and applies new CSS for 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 a duplicate-signup validation in signup_for_activity |
| src/static/app.js | Updated activity card markup to include a participants section and relabeled fields |
| src/static/styles.css | Added styles for .participants-section and .participants-list |
Comments suppressed due to low confidence (1)
src/app.py:105
- Consider adding a test case to cover the duplicate signup validation path, ensuring the HTTP 400 error is thrown as expected.
if email in activity["participants"]:
Comment on lines
+32
to
+33
| ? details.participants.map(p => `<li>${p}</li>`).join('') | ||
| : '<li><em>No participants yet</em></li>'} |
There was a problem hiding this comment.
Rendering participant names directly via innerHTML opens a risk for XSS if the data isn't sanitized. Consider using DOM methods or sanitizing input before insertion.
Suggested change
| ? details.participants.map(p => `<li>${p}</li>`).join('') | |
| : '<li><em>No participants yet</em></li>'} | |
| ? (() => { | |
| const participantsList = document.createDocumentFragment(); | |
| details.participants.forEach(p => { | |
| const listItem = document.createElement("li"); | |
| listItem.textContent = p; | |
| participantsList.appendChild(listItem); | |
| }); | |
| return participantsList; | |
| })() | |
| : (() => { | |
| const noParticipantsItem = document.createElement("li"); | |
| noParticipantsItem.innerHTML = "<em>No participants yet</em>"; | |
| return noParticipantsItem.outerHTML; | |
| })()} |
| <p><strong>Description:</strong> ${details.description}</p> | ||
| <p><strong>Schedule:</strong> ${details.schedule}</p> | ||
| <p><strong>Availability:</strong> ${spotsLeft} spots left</p> | ||
| <p><strong>Max Participants:</strong> ${details.max_participants}</p> |
There was a problem hiding this comment.
[nitpick] Previously the UI displayed available spots; consider also computing and showing remaining slots (max_participants minus current participants) to maintain consistency in availability info.
Suggested change
| <p><strong>Max Participants:</strong> ${details.max_participants}</p> | |
| <p><strong>Max Participants:</strong> ${details.max_participants}</p> | |
| <p><strong>Remaining Slots:</strong> ${spotsLeft}</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 enhancements to the activity management system by adding new activities, improving validation for participant signup, and updating the UI to display participant information. Additionally, it includes styling updates for better visual presentation of participant details.
Backend Changes:
src/app.py, src/app.pyR41-R79)src/app.py, src/app.pyR104-R107)Frontend Changes:
src/static/app.js, src/static/app.jsL25-R35)src/static/styles.css, src/static/styles.cssR145-R167)