Skip to content

Improve student activity registration system - #2

Merged
JesperGr merged 3 commits into
mainfrom
accelerate-with-copilot
Jul 15, 2026
Merged

Improve student activity registration system#2
JesperGr merged 3 commits into
mainfrom
accelerate-with-copilot

Conversation

@JesperGr

Copy link
Copy Markdown
Owner

This pull request introduces several new features and improvements to the FastAPI student activities app, focusing on participant management, UI enhancements, and automated testing. The most important changes are grouped below by theme.

Backend: Activity and Participant Management

  • Added several new activities (e.g., Basketball Team, Tennis Club, Art Studio, Music Band, Debate Club, Science Club) to the activities data structure in app.py.
  • Implemented a new DELETE endpoint /activities/{activity_name}/participants to allow unregistering a student from an activity, including validation and error handling.
  • Updated the signup endpoint to prevent duplicate participant registrations by returning a 400 error if the student is already signed up.

Frontend: User Interface and Experience

  • Enhanced the activity cards to display a sorted, styled list of participants, each with an "unregister" button. [1] [2]
  • Added JavaScript logic to handle participant removal via the new DELETE endpoint, with real-time UI updates and error messaging.

Testing and Documentation

  • Added a comprehensive test suite (test_app.py) covering all main API endpoints and edge cases, including signup, unregister, and error conditions.
  • Introduced a conftest.py fixture to ensure test isolation by resetting the activities state before each test.
  • Updated the README.md to instruct users to install dependencies via requirements.txt and added a section on how to run tests with pytest. [1] [2]

Copilot AI left a comment

Copy link
Copy Markdown

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 FastAPI-based student activities application by expanding available activities, adding participant unregister support, improving the UI to manage participants, and adding automated tests and documentation updates.

Changes:

  • Added new activities and prevented duplicate signups on the /activities/{activity_name}/signup endpoint.
  • Introduced a DELETE endpoint to unregister a participant (/activities/{activity_name}/participants) and updated the frontend to support “unregister” actions.
  • Added a pytest suite (with isolation fixture) and updated docs/dependencies to support running tests.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/app.py Adds new activities, duplicate-signup protection, and a participant-unregister endpoint.
src/static/app.js Renders participants (sorted) with per-participant unregister buttons and wires DELETE requests + UI refresh.
src/static/styles.css Styles the new participants section and unregister button.
tests/test_app.py Adds API tests for redirect, listing activities, signup, duplicate prevention, and unregister behavior.
tests/conftest.py Provides a TestClient fixture and resets in-memory activities state between tests.
src/README.md Updates install instructions to use requirements.txt and adds how to run tests.
requirements.txt Adds pytest dependency for the new test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/static/app.js
Comment on lines +23 to +44
const sortedParticipants = [...details.participants].sort((a, b) =>
a.localeCompare(b, undefined, { sensitivity: "base" })
);
const participantsList = sortedParticipants
.map(
(participant) => `
<li class="participant-item">
<span class="participant-email">${participant}</span>
<button
type="button"
class="participant-delete"
data-activity="${name}"
data-email="${participant}"
aria-label="Unregister ${participant} from ${name}"
title="Unregister participant"
>
<span aria-hidden="true">&#128465;</span>
</button>
</li>
`
)
.join("");
Comment thread tests/conftest.py
@JesperGr
JesperGr merged commit 40e6921 into main Jul 15, 2026
5 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.

2 participants