Skip to content

Conversation

@wtobis-splunk
Copy link
Owner

This pull request introduces new activity options, enhances the signup validation logic, and improves the user interface to display participant details. The most important changes include adding new activities, validating duplicate signups, and updating the frontend to show participant lists with styling.

Backend Changes:

  • New Activities Added: Expanded the activities dictionary in src/app.py to include sports, artistic, and intellectual activities such as Soccer Team, Art Club, and Math Olympiad. Each activity includes a description, schedule, maximum participants, and initial participant list.
  • Duplicate Signup Validation: Updated the signup_for_activity function in src/app.py to prevent students from signing up for an activity multiple times. Throws an HTTPException if the student is already signed up.

Frontend Changes:

  • Participant List Display: Modified the src/static/app.js file to show a list of participants for each activity on the activity card. Displays "No participants yet" if the list is empty.
  • Styling for Participant Section: Added styles in src/static/styles.css for the participant section, including background color, padding, and list formatting to enhance visual presentation.

@wtobis-splunk wtobis-splunk requested a review from Copilot June 24, 2025 17:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR expands the set of available activities, prevents duplicate signups on the backend, and updates the frontend to display participant lists with new styling.

  • Backend: added new activity entries and duplicate‐signup validation
  • Frontend: renders participant lists in each activity card
  • Styling: introduced CSS rules for the participants section

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/app.py Added sports, artistic, and intellectual activities; implemented duplicate signup check
src/static/app.js Injects a <ul> of participants (or placeholder) into each activity card
src/static/styles.css Defines layout and styling for .participants-section and .participants-list
Comments suppressed due to low confidence (3)

src/app.py:106

  • [nitpick] A 400 status is generic for this case—using 409 Conflict would more accurately convey that the signup request conflicts with existing registration.
        raise HTTPException(status_code=400, detail="Student already signed up")

src/app.py:104

  • The new duplicate‐signup branch should have corresponding unit tests to ensure the HTTPException is raised correctly and that valid signups still succeed.
    # Validate student is not already signed up

src/static/app.js:31

  • Interpolating p directly into HTML can open an XSS vulnerability if participant data isn’t sanitized. Consider creating <li> elements via DOM APIs or escaping p before insertion.
              ${details.participants.length > 0 ? details.participants.map(p => `<li>${p}</li>`).join("") : '<li><em>No participants yet</em></li>'}

# Validate student is not already signed up
if email in activity["participants"]:
raise HTTPException(status_code=400, detail="Student already signed up")

Copy link

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there’s no check against max_participants. You should validate len(activity['participants']) < activity['max_participants'] before appending to prevent overbooking.

Suggested change
# Validate activity is not overbooked
if len(activity["participants"]) >= activity["max_participants"]:
raise HTTPException(status_code=400, detail="Activity is fully booked")

Copilot uses AI. Check for mistakes.
@wtobis-splunk wtobis-splunk merged commit 2ec7edd into main Jun 24, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant