-
Notifications
You must be signed in to change notification settings - Fork 0
Add registration validation and more activities #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| fastapi | ||
| uvicorn | ||
| pymongo |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| from pymongo import MongoClient | ||
| from app import initial_activities | ||
|
|
||
| # Connect to MongoDB | ||
| client = MongoClient('mongodb://localhost:27017/') | ||
| db = client['school_activities'] | ||
| activities_collection = db['activities'] | ||
|
|
||
| # Clear existing data | ||
| activities_collection.delete_many({}) | ||
|
|
||
| # Insert initial activities | ||
| for name, details in initial_activities.items(): | ||
| activities_collection.insert_one({"_id": name, **details}) | ||
|
|
||
| print("Database initialized successfully!") |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,12 +20,30 @@ document.addEventListener("DOMContentLoaded", () => { | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const spotsLeft = details.max_participants - details.participants.length; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| activityCard.innerHTML = ` | ||||||||||||||||||||||||||||||
| <h4>${name}</h4> | ||||||||||||||||||||||||||||||
| <p>${details.description}</p> | ||||||||||||||||||||||||||||||
| <p><strong>Schedule:</strong> ${details.schedule}</p> | ||||||||||||||||||||||||||||||
| <p><strong>Availability:</strong> ${spotsLeft} spots left</p> | ||||||||||||||||||||||||||||||
| `; | ||||||||||||||||||||||||||||||
| activityCard.innerHTML = ` | ||||||||||||||||||||||||||||||
| <h4>${name}</h4> | ||||||||||||||||||||||||||||||
| <p>${details.description}</p> | ||||||||||||||||||||||||||||||
| <p><strong>Schedule:</strong> ${details.schedule}</p> | ||||||||||||||||||||||||||||||
| <p><strong>Availability:</strong> ${spotsLeft} spots left</p> | ||||||||||||||||||||||||||||||
| <div class="participants-section"> | ||||||||||||||||||||||||||||||
| <strong>Participants:</strong> | ||||||||||||||||||||||||||||||
| ${ | ||||||||||||||||||||||||||||||
| details.participants.length > 0 | ||||||||||||||||||||||||||||||
| ? `<ul class="participants-list" style="list-style: none; padding-left: 0;"> | ||||||||||||||||||||||||||||||
| ${details.participants | ||||||||||||||||||||||||||||||
| .map( | ||||||||||||||||||||||||||||||
| (participant) => | ||||||||||||||||||||||||||||||
| `<li class="participant-item" style="display: flex; align-items: center;"> | ||||||||||||||||||||||||||||||
| <span>${participant}</span> | ||||||||||||||||||||||||||||||
| <span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}" style="cursor: pointer; margin-left: 8px; color: #d00; font-weight: bold;">✖</span> | ||||||||||||||||||||||||||||||
|
Comment on lines
+32
to
+38
|
||||||||||||||||||||||||||||||
| ? `<ul class="participants-list" style="list-style: none; padding-left: 0;"> | |
| ${details.participants | |
| .map( | |
| (participant) => | |
| `<li class="participant-item" style="display: flex; align-items: center;"> | |
| <span>${participant}</span> | |
| <span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}" style="cursor: pointer; margin-left: 8px; color: #d00; font-weight: bold;">✖</span> | |
| ? `<ul class="participants-list"> | |
| ${details.participants | |
| .map( | |
| (participant) => | |
| `<li class="participant-item"> | |
| <span>${participant}</span> | |
| <span class="delete-icon" title="Remove participant" data-activity="${name}" data-participant="${participant}">✖</span> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,6 +63,7 @@ section h3 { | |
| border: 1px solid #ddd; | ||
| border-radius: 5px; | ||
| background-color: #f9f9f9; | ||
| position: relative; | ||
| } | ||
|
|
||
| .activity-card h4 { | ||
|
|
@@ -74,6 +75,60 @@ section h3 { | |
| margin-bottom: 8px; | ||
| } | ||
|
|
||
| .participants-section { | ||
| margin-top: 12px; | ||
| padding: 10px; | ||
| background-color: #eef2f7; | ||
| border-radius: 4px; | ||
| border: 1px solid #dde3ec; | ||
| } | ||
|
|
||
| .participants-section strong { | ||
| display: block; | ||
| margin-bottom: 6px; | ||
| color: #3949ab; | ||
| } | ||
|
|
||
| .participants-list { | ||
| list-style-type: disc; | ||
| margin-left: 20px; | ||
| margin-bottom: 0; | ||
| padding-left: 0; | ||
|
|
||
| list-style: none; | ||
| padding-left: 0; | ||
| } | ||
|
Comment on lines
+92
to
+100
|
||
|
|
||
| .participant-item { | ||
| display: flex; | ||
| align-items: center; | ||
| } | ||
|
Comment on lines
+102
to
+105
|
||
|
|
||
| .delete-icon { | ||
| cursor: pointer; | ||
| margin-left: 8px; | ||
| color: #d00; | ||
| font-weight: bold; | ||
| transition: color 0.2s; | ||
| } | ||
|
|
||
| .delete-icon:hover { | ||
| color: #a00; | ||
| } | ||
|
|
||
| .participant-item { | ||
| margin-bottom: 4px; | ||
| color: #333; | ||
| font-size: 15px; | ||
| } | ||
|
Comment on lines
+119
to
+123
|
||
|
|
||
| .no-participants { | ||
| color: #888; | ||
| font-style: italic; | ||
| margin-left: 2px; | ||
| margin-bottom: 0; | ||
| } | ||
|
|
||
| .form-group { | ||
| margin-bottom: 15px; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline styles are being used when CSS classes already exist for the same properties. Remove the inline styles and rely on the existing CSS classes
.participants-list,.participant-item, and.delete-iconto maintain consistency and improve maintainability.