| | 1 | = UseCase3001 – Enroll in Subject |
| | 2 | |
| | 3 | **Initiating actor:** Student |
| | 4 | **Other actors:** Professor |
| | 5 | |
| | 6 | **Description:** |
| | 7 | A student wants to enroll in a subject offered by their faculty. The system checks prerequisites, enrollment limits, and records the enrollment in the database. |
| | 8 | |
| | 9 | **Scenario:** |
| | 10 | |
| | 11 | 1. Student logs into the system and selects “Enroll in Subject.” |
| | 12 | |
| | 13 | 2. System displays a list of subjects available for their faculty: |
| | 14 | {{{ |
| | 15 | SELECT s.Id, s.Name, s.Semester, s.Credits |
| | 16 | FROM Subject s |
| | 17 | JOIN Faculty f ON s.Faculty_Id = f.Id |
| | 18 | JOIN Student st ON st.Faculty_Id = f.Id |
| | 19 | WHERE st.Id = :student_id; |
| | 20 | }}} |
| | 21 | |
| | 22 | 3. Student chooses a subject and clicks “Enroll.” |
| | 23 | |
| | 24 | 4. System checks if the student is already enrolled: |
| | 25 | {{{ |
| | 26 | SELECT * FROM Student_Subject |
| | 27 | WHERE Student_Id = :student_id AND Subject_Id = :subject_id; |
| | 28 | }}} |
| | 29 | |
| | 30 | 5. If not enrolled, system inserts enrollment record: |
| | 31 | {{{ |
| | 32 | INSERT INTO Student_Subject(Student_Id, Subject_Id, Status, Enrollment_Date, Absences_Count) |
| | 33 | VALUES (:student_id, :subject_id, 'ENROLLED', CURRENT_DATE, 0); |
| | 34 | }}} |
| | 35 | |
| | 36 | 6. System confirms enrollment and updates student's schedule. |