| | 1 | = Use-case 0011 - Assign Attendance / Seating = |
| | 2 | |
| | 3 | '''Initiating actor:''' Wedding Organizer (Assistant) |
| | 4 | |
| | 5 | '''Other actors:''' Bride / Groom (Wedding owner) |
| | 6 | |
| | 7 | == Description == |
| | 8 | The organizer assigns seating details and attendance metadata for guests per event, including table number and role (e.g., Guest, Maid of Honor, Best Man). This data is stored in Attendance. |
| | 9 | |
| | 10 | == Scenario == |
| | 11 | 1. The organizer selects an event. |
| | 12 | 2. The system lists guests with RSVP info. |
| | 13 | |
| | 14 | {{{ |
| | 15 | SET search_path TO project; |
| | 16 | |
| | 17 | SELECT g.guest_id, g.first_name, g.last_name, |
| | 18 | COALESCE(r.status, 'pending') AS rsvp_status |
| | 19 | FROM guest g |
| | 20 | LEFT JOIN event_rsvp r ON r.guest_id = g.guest_id AND r.event_id = :event_id |
| | 21 | WHERE g.wedding_id = :wedding_id |
| | 22 | ORDER BY g.last_name, g.first_name; |
| | 23 | }}} |
| | 24 | |
| | 25 | 3. The organizer assigns table number and role. |
| | 26 | 4. The system saves attendance record. |
| | 27 | |
| | 28 | {{{ |
| | 29 | SET search_path TO project; |
| | 30 | |
| | 31 | INSERT INTO attendance(status, table_number, role, guest_id, event_id) |
| | 32 | VALUES (:status, :table_number, :role, :guest_id, :event_id) |
| | 33 | RETURNING attendance_id; |
| | 34 | }}} |
| | 35 | |
| | 36 | 5. If an attendance record already exists, the system updates it. |
| | 37 | |
| | 38 | {{{ |
| | 39 | SET search_path TO project; |
| | 40 | |
| | 41 | UPDATE attendance |
| | 42 | SET status = :status, |
| | 43 | table_number = :table_number, |
| | 44 | role = :role |
| | 45 | WHERE guest_id = :guest_id AND event_id = :event_id; |
| | 46 | }}} |
| | 47 | |
| | 48 | 6. The system confirms seating/attendance update. |