Skip to content

Conversation

@vaariable
Copy link
Owner

This pull request enhances the activity management system by adding new activities, improving signup validation, and enhancing the frontend to display participant details. Key changes include expanding the in-memory database, adding validation to prevent duplicate signups, and updating the UI to show participant lists with styled formatting.

Backend Enhancements:

  • Added six new activities (Soccer Team, Basketball Team, Art Club, Drama Club, Math Club, and Science Club) to the in-memory activities database, each with descriptions, schedules, maximum participants, and initial participant lists. (src/app.py, src/app.pyR24-R59)
  • Updated the signup_for_activity function to include a validation step that prevents students from signing up for the same activity multiple times. If a duplicate signup is detected, an HTTP 400 error is raised. (src/app.py, src/app.pyR101-R104)

Frontend Improvements:

  • Enhanced the activity card UI to display a list of participants for each activity. If no participants are signed up, a placeholder message ("No participants yet.") is shown. (src/static/app.js, src/static/app.jsR23-R35)
  • Introduced new CSS styles for the participants section, including a bordered and highlighted box with styled headers and list items for better readability. (src/static/styles.css, src/static/styles.cssR139-R161)

@vaariable vaariable requested a review from Copilot April 30, 2025 18:04
@vaariable vaariable changed the title Accelerate with copilot Add registration validation and more activities Apr 30, 2025
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 pull request enhances the activity management system by adding several new activities, preventing duplicate signups, and improving the UI to display participant details.

  • Expanded the in-memory activities database with six new clubs
  • Added duplicate-signup validation in the backend
  • Updated the activities card UI to dynamically display the list of participants

Reviewed Changes

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

File Description
src/app.py Added new activities and duplicate signup validation
src/static/app.js Enhanced UI to display participants with a conditional placeholder
Files not reviewed (1)
  • src/static/styles.css: Language not supported
Comments suppressed due to low confidence (1)

src/static/app.js:24

  • Directly injecting participant data into the innerHTML could expose a potential XSS risk if the data is ever manipulated in an unexpected way. Consider sanitizing the participant values or using safer methods to populate list items.
const participantsList = details.participants.length ? `<ul>${details.participants.map(participant => `<li>${participant}</li>`).join('')}</ul>` : "<p>No participants yet.</p>";

app.mount("/static", StaticFiles(directory=os.path.join(Path(__file__).parent,
"static")), name="static")

# In-memory activity database
Copy link

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding a comment block to summarize the new activities in the in-memory database for improved readability and maintenance.

Suggested change
# In-memory activity database
# In-memory activity database
# This dictionary stores information about extracurricular activities available at Mergington High School.
# Each activity is represented as a key-value pair, where the key is the activity name (string) and the value
# is a dictionary containing:
# - "description": A brief description of the activity.
# - "schedule": The days and times the activity takes place.
# - "max_participants": The maximum number of participants allowed.
# - "participants": A list of email addresses of current participants.

Copilot uses AI. Check for mistakes.
@vaariable vaariable merged commit 838c027 into main Apr 30, 2025
7 checks passed
@vaariable vaariable deleted the accelerate-with-copilot branch April 30, 2025 18:11
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.

2 participants