1 | | = Student selects a class that is going to attend = |
| 1 | = Student Class Selection Process = |
| 2 | |
| 3 | == Step 1 - System Login == |
| 4 | The student logs into the system using their **email** and **password**. The password is securely hashed before verification. |
| 5 | |
| 6 | {{{ |
| 7 | SELECT id_user, username |
| 8 | FROM User |
| 9 | WHERE email = :input_email AND password = :hashed_input_pass; |
| 10 | }}} |
| 11 | ''Note:'' `:hashed_input_pass` is securely hashed before being checked. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | == Step 2 - Student Dashboard == |
| 16 | After logging in, the student can see their **enrolled courses** and **available classes**. |
| 17 | |
| 18 | === List Enrolled Courses === |
| 19 | {{{ |
| 20 | SELECT c.id_Course, s.name AS subject_name, c.num_of_classes |
| 21 | FROM Enrollment e |
| 22 | JOIN Course c ON e.id_Course = c.id_Course |
| 23 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 24 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 25 | WHERE e.id_student = :curr_student_id; |
| 26 | }}} |
| 27 | Displays the courses the student is currently enrolled in. |
| 28 | |
| 29 | === List Upcoming Available Classes === |
| 30 | {{{ |
| 31 | SELECT cl.id_class, cl.start_time, cl.end_time, cl.duration, t.id_teacher, u.username AS teacher_name, s.name AS subject_name |
| 32 | FROM Class cl |
| 33 | JOIN Teacher t ON cl.teacher_id = t.id_teacher |
| 34 | JOIN User u ON t.id_user = u.id_user |
| 35 | JOIN Course_Class cc ON cl.id_class = cc.id_class |
| 36 | JOIN Course c ON cc.id_Course = c.id_Course |
| 37 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 38 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 39 | WHERE cl.start_time >= CURRENT_TIME |
| 40 | AND c.id_Course IN (SELECT id_Course FROM Enrollment WHERE id_student = :curr_student_id); |
| 41 | }}} |
| 42 | Lists upcoming classes for courses the student is enrolled in. |
| 43 | |
| 44 | --- |
| 45 | |
| 46 | == Step 3 - Selecting a Class to Attend == |
| 47 | The student clicks on an **"Attend Class"** button next to an available class. |
| 48 | |
| 49 | --- |
| 50 | |
| 51 | == Step 4 - Registering Attendance == |
| 52 | The system registers the student's attendance for the selected class. |
| 53 | |
| 54 | === Insert Attendance Record === |
| 55 | {{{ |
| 56 | INSERT INTO Attendance (id_attendance, id_student, id_class, attended) |
| 57 | VALUES (:new_attendance_id, :curr_student_id, :selected_class_id, TRUE); |
| 58 | }}} |
| 59 | Marks the student as attending the selected class. |
| 60 | |
| 61 | --- |
| 62 | |
| 63 | == Step 5 - Viewing Attendance History == |
| 64 | The student can review their past attendance records. |
| 65 | |
| 66 | === Retrieve Attendance History === |
| 67 | {{{ |
| 68 | SELECT a.id_class, cl.start_time, cl.end_time, cl.duration, s.name AS subject_name, a.attended |
| 69 | FROM Attendance a |
| 70 | JOIN Class cl ON a.id_class = cl.id_class |
| 71 | JOIN Course_Class cc ON cl.id_class = cc.id_class |
| 72 | JOIN Course c ON cc.id_Course = c.id_Course |
| 73 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 74 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 75 | WHERE a.id_student = :curr_student_id |
| 76 | ORDER BY cl.start_time DESC; |
| 77 | }}} |
| 78 | Displays all past classes the student attended. |
| 79 | |
| 80 | --- |
| 81 | |
| 82 | == Step 6 - Checking Completed Classes == |
| 83 | The student can see which classes they have **completed**. |
| 84 | |
| 85 | === Retrieve Completed Classes === |
| 86 | {{{ |
| 87 | SELECT DISTINCT cl.id_class, cl.start_time, cl.end_time, cl.duration, s.name AS subject_name |
| 88 | FROM Attendance a |
| 89 | JOIN Class cl ON a.id_class = cl.id_class |
| 90 | JOIN Course_Class cc ON cl.id_class = cc.id_class |
| 91 | JOIN Course c ON cc.id_Course = c.id_Course |
| 92 | JOIN Subject_Course sc ON c.id_Course = sc.id_Course |
| 93 | JOIN Subject s ON sc.id_subject = s.id_subject |
| 94 | WHERE a.id_student = :curr_student_id AND cl.end_time <= CURRENT_TIME; |
| 95 | }}} |
| 96 | Lists all classes the student has **already completed**. |
| 97 | |
| 98 | --- |
| 99 | |
| 100 | == Step 7 - Unregistering from a Class (Optional) == |
| 101 | If a student mistakenly registers for a class, they can **remove themselves**. |
| 102 | |
| 103 | === Remove Attendance Record === |
| 104 | {{{ |
| 105 | DELETE FROM Attendance |
| 106 | WHERE id_student = :curr_student_id AND id_class = :selected_class_id; |
| 107 | }}} |
| 108 | Removes the student's attendance entry. |
| 109 | |
| 110 | --- |
| 111 | |
| 112 | == Conclusion == |
| 113 | This process allows students to: |
| 114 | ✔ Log in to the system. |
| 115 | ✔ View enrolled courses and available classes. |
| 116 | ✔ Select and attend classes. |
| 117 | ✔ Track attendance and completed classes. |
| 118 | ✔ Optionally unregister from a class if needed. |