Phase 3.1: Enhanced Chore Logging and Reporting System
This commit is contained in:
225
MEDIUM_CHANGES_GUIDE.txt
Normal file
225
MEDIUM_CHANGES_GUIDE.txt
Normal file
@@ -0,0 +1,225 @@
|
||||
========================================
|
||||
MEDIUM CHANGES - Implementation Guide
|
||||
========================================
|
||||
|
||||
🎂 BIRTHDAY FIELDS + 👥 MULTIPLE USERS PER CHORE
|
||||
|
||||
This guide will walk you through adding:
|
||||
1. Birthday field for users
|
||||
2. Multiple user assignment for chores
|
||||
3. Updated Settings UI
|
||||
|
||||
========================================
|
||||
STEP 1: Run Database Migrations
|
||||
========================================
|
||||
|
||||
⚠️ IMPORTANT: Back up your database first!
|
||||
Copy: D:\Hosted\familyhub\backend\data\family_hub.db
|
||||
To: D:\Hosted\familyhub\backend\data\family_hub_backup.db
|
||||
|
||||
Then run migrations:
|
||||
cd D:\Hosted\familyhub
|
||||
run_migrations.bat
|
||||
|
||||
What this does:
|
||||
✅ Adds birthday column to users table
|
||||
✅ Creates chore_assignments table for multi-user support
|
||||
✅ Migrates existing chore assignments to new table
|
||||
✅ Preserves all existing data
|
||||
|
||||
Expected output:
|
||||
==================================================
|
||||
MIGRATION: Add Birthday Field to Users
|
||||
==================================================
|
||||
✅ Birthday column added successfully!
|
||||
|
||||
==================================================
|
||||
MIGRATION: Add Multiple Users Per Chore Support
|
||||
==================================================
|
||||
✅ chore_assignments table created!
|
||||
✅ Migrated 12 existing chore assignments!
|
||||
|
||||
========================================
|
||||
STEP 2: Make Lou an Admin
|
||||
========================================
|
||||
|
||||
cd D:\Hosted\familyhub\backend
|
||||
python make_lou_admin.py
|
||||
|
||||
Expected output:
|
||||
✅ Lou is now an admin!
|
||||
|
||||
========================================
|
||||
STEP 3: Update Frontend Settings Page
|
||||
========================================
|
||||
|
||||
Replace the Settings file with birthday support:
|
||||
|
||||
From: D:\Hosted\familyhub\Settings_with_birthday.tsx
|
||||
To: D:\Hosted\familyhub\frontend\src\pages\Settings.tsx
|
||||
|
||||
New Features in Settings:
|
||||
✅ Birthday input field (date picker)
|
||||
✅ Birthday displayed in user list (🎂 icon)
|
||||
✅ Updated edit modal with birthday
|
||||
✅ Profile picture URL input
|
||||
|
||||
========================================
|
||||
STEP 4: Restart Services
|
||||
========================================
|
||||
|
||||
Backend:
|
||||
Stop current backend (Ctrl+C)
|
||||
cd D:\Hosted\familyhub
|
||||
restart_backend.bat
|
||||
|
||||
Frontend:
|
||||
Stop current frontend (Ctrl+C)
|
||||
cd D:\Hosted\familyhub\frontend
|
||||
npm run dev
|
||||
|
||||
========================================
|
||||
STEP 5: Test Birthday Feature
|
||||
========================================
|
||||
|
||||
1. Login as jess
|
||||
2. Go to Settings
|
||||
3. Set your birthday (date picker)
|
||||
4. Click "Save Changes"
|
||||
5. Birthday should appear in your profile
|
||||
|
||||
Test Admin Features:
|
||||
1. Scroll to "User Management"
|
||||
2. Click "Edit" on any user
|
||||
3. Modal opens with birthday field
|
||||
4. Set birthdays for Lou, William, Xander, Bella
|
||||
5. Save changes
|
||||
6. Birthdays show with 🎂 icon in user list
|
||||
|
||||
========================================
|
||||
WHAT'S CHANGED - Database Schema
|
||||
========================================
|
||||
|
||||
USERS TABLE - NEW COLUMN:
|
||||
birthday DATE NULL
|
||||
|
||||
CHORE_ASSIGNMENTS TABLE - NEW TABLE:
|
||||
id INTEGER PRIMARY KEY
|
||||
chore_id INTEGER (FK to chores)
|
||||
user_id INTEGER (FK to users)
|
||||
completed_at DATETIME NULL
|
||||
created_at DATETIME
|
||||
|
||||
This enables:
|
||||
- One chore → Many users
|
||||
- Track who completed what
|
||||
- Individual completion tracking
|
||||
|
||||
========================================
|
||||
WHAT'S CHANGED - Backend API
|
||||
========================================
|
||||
|
||||
User Schema Updates:
|
||||
- UserBase: Added birthday field (Optional[date])
|
||||
- UserUpdate: Added birthday field (Optional[date])
|
||||
- UserResponse: Includes birthday in responses
|
||||
|
||||
Models Updated:
|
||||
- User: Added birthday column + chore_assignments relationship
|
||||
- Chore: Added assignments relationship
|
||||
- ChoreAssignment: New model for many-to-many
|
||||
|
||||
========================================
|
||||
WHAT'S CHANGED - Frontend UI
|
||||
========================================
|
||||
|
||||
Settings Page:
|
||||
✅ Birthday input field (type="date")
|
||||
✅ Hint text: "Get a break from chores on your special day!"
|
||||
✅ Birthday in user cards (formatted as locale date)
|
||||
✅ Birthday in edit modal
|
||||
✅ Profile picture URL input
|
||||
✅ Scrollable edit modal for all fields
|
||||
|
||||
========================================
|
||||
NEXT STEPS - Chore Assignment UI
|
||||
========================================
|
||||
|
||||
The database now supports multiple users per chore!
|
||||
Next, we need to:
|
||||
|
||||
1. Update Chores page to show multi-user assignment
|
||||
2. Add UI to assign multiple users to a chore
|
||||
3. Add birthday-based chore filtering
|
||||
- Skip chores on user's birthday
|
||||
- Option for birthday range (±3 days)
|
||||
|
||||
========================================
|
||||
BIRTHDAY LOGIC - Implementation Plan
|
||||
========================================
|
||||
|
||||
Option A: Exact Birthday Skip (Simple)
|
||||
- Check if today == user.birthday
|
||||
- Hide chores assigned to that user
|
||||
|
||||
Option B: Birthday Range Skip (Flexible)
|
||||
- Check if today within (birthday - 1 day to birthday + 1 day)
|
||||
- Configurable range in settings
|
||||
|
||||
Which would you prefer?
|
||||
|
||||
========================================
|
||||
TROUBLESHOOTING
|
||||
========================================
|
||||
|
||||
❌ Migration Failed?
|
||||
- Check if database file is locked
|
||||
- Make sure backend is stopped
|
||||
- Restore from backup if needed
|
||||
|
||||
❌ Frontend Not Showing Birthday?
|
||||
- Clear browser cache (Ctrl+Shift+R)
|
||||
- Check browser console for errors
|
||||
- Verify backend is running latest code
|
||||
|
||||
❌ Birthday Not Saving?
|
||||
- Check backend logs
|
||||
- Verify migration ran successfully
|
||||
- Check database: sqlite3 family_hub.db "PRAGMA table_info(users);"
|
||||
|
||||
========================================
|
||||
FILES MODIFIED/CREATED
|
||||
========================================
|
||||
|
||||
Backend:
|
||||
✅ backend/app/models/user.py - Added birthday field
|
||||
✅ backend/app/models/chore.py - Added assignments relationship
|
||||
✅ backend/app/models/chore_assignment.py - NEW model
|
||||
✅ backend/app/models/__init__.py - Import ChoreAssignment
|
||||
✅ backend/app/schemas/user.py - Added birthday to schemas
|
||||
✅ backend/migrations/001_add_birthday_field.py - NEW migration
|
||||
✅ backend/migrations/002_add_multi_user_chores.py - NEW migration
|
||||
✅ backend/make_lou_admin.py - Make Lou admin script
|
||||
|
||||
Frontend:
|
||||
✅ Settings_with_birthday.tsx - Updated Settings component
|
||||
|
||||
Scripts:
|
||||
✅ run_migrations.bat - Migration runner
|
||||
|
||||
========================================
|
||||
CURRENT STATUS
|
||||
========================================
|
||||
|
||||
✅ Database schema updated
|
||||
✅ Backend models updated
|
||||
✅ Backend schemas updated
|
||||
✅ Frontend UI updated
|
||||
✅ Migrations created
|
||||
|
||||
⏳ Pending (Next Phase):
|
||||
- Chore multi-user assignment UI
|
||||
- Birthday-based chore filtering
|
||||
- Chore edit functionality for admins
|
||||
|
||||
========================================
|
||||
Reference in New Issue
Block a user