Changes between Initial Version and Version 1 of Creation of a class


Ignore:
Timestamp:
02/10/25 17:04:17 (12 days ago)
Author:
206046
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Creation of a class

    v1 v1  
     1= Teacher Class Creation Process =
     2
     3== Step 1 - System Login ==
     4The teacher logs into the system by entering their **email** and **password**. The password is hashed and checked against the database.
     5
     6{{{
     7SELECT id_user, username
     8FROM User
     9WHERE 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 - Teacher Dashboard ==
     16After logging in, the teacher can see the **subjects** and **classes** they are assigned to.
     17
     18=== List Subjects Assigned to the Teacher ===
     19{{{
     20SELECT DISTINCT s.id_subject, s.name AS subject_name
     21FROM Teacher t
     22JOIN Course c ON t.id_teacher = c.created_by
     23JOIN Subject_Course sc ON c.id_Course = sc.id_Course
     24JOIN Subject s ON sc.id_subject = s.id_subject
     25WHERE t.id_user = :curr_usr_id;
     26}}}
     27Displays all subjects the teacher is responsible for.
     28
     29=== List Teacher’s Upcoming Classes ===
     30{{{
     31SELECT cl.id_class, cl.start_time, cl.end_time, cl.duration, c.id_Course, s.name AS subject_name
     32FROM Class cl
     33JOIN Teacher t ON cl.teacher_id = t.id_teacher
     34JOIN Course_Class cc ON cl.id_class = cc.id_class
     35JOIN Course c ON cc.id_Course = c.id_Course
     36JOIN Subject_Course sc ON c.id_Course = sc.id_Course
     37JOIN Subject s ON sc.id_subject = s.id_subject
     38WHERE t.id_user = :curr_usr_id AND cl.start_time >= CURRENT_TIME;
     39}}}
     40Lists upcoming classes assigned to the teacher.
     41
     42---
     43
     44== Step 3 - Creating a New Class ==
     45The teacher clicks the **"Create New Class"** button and is redirected to a form to enter class details.
     46
     47---
     48
     49== Step 4 - Filling Out the Class Creation Form ==
     50The teacher selects: 
     51 * **Subject** – From the list of subjects they teach. 
     52 * **Start Time** – Class start time (`HH:MM:SS`). 
     53 * **End Time** – Class end time (`HH:MM:SS`). 
     54 * **Duration** – Automatically calculated based on start and end time. 
     55 * **Course** – The course that this class belongs to. 
     56
     57=== Retrieve Subjects for Selection ===
     58{{{
     59SELECT DISTINCT s.id_subject, s.name
     60FROM Subject s
     61JOIN Subject_Course sc ON s.id_subject = sc.id_subject
     62JOIN Course c ON sc.id_Course = c.id_Course
     63WHERE c.created_by = :curr_teacher_id;
     64}}}
     65
     66---
     67
     68== Step 5 - Submitting the Class to the Database ==
     69After filling in the form, the system inserts the new class record.
     70
     71=== Insert New Class ===
     72{{{
     73INSERT INTO Class (id_class, start_time, end_time, duration, teacher_id)
     74VALUES (:id_class, :start_time, :end_time, TIMESTAMPDIFF(MINUTE, :start_time, :end_time), :teacher_id);
     75}}}
     76''Duration is automatically calculated using TIMESTAMPDIFF().''
     77
     78=== Link the Class to a Course ===
     79{{{
     80INSERT INTO Course_Class (id_Course, id_class)
     81VALUES (:selected_course_id, :id_class);
     82}}}
     83Links the new class to an existing course.
     84
     85---
     86
     87== Step 6 - Confirmation & Viewing the Schedule ==
     88Once the new class is created, the teacher can view their **updated schedule**.
     89
     90=== Retrieve Updated Class Schedule ===
     91{{{
     92SELECT cl.id_class, cl.start_time, cl.end_time, cl.duration, s.name AS subject_name
     93FROM Class cl
     94JOIN Course_Class cc ON cl.id_class = cc.id_class
     95JOIN Course c ON cc.id_Course = c.id_Course
     96JOIN Subject_Course sc ON c.id_Course = sc.id_Course
     97JOIN Subject s ON sc.id_subject = s.id_subject
     98WHERE cl.teacher_id = :curr_teacher_id
     99ORDER BY cl.start_time ASC;
     100}}}
     101Shows all upcoming classes assigned to the teacher.
     102
     103---
     104
     105== Step 7 - Managing Classes ==
     106Teachers can **modify** or **cancel** classes if needed.
     107
     108=== Cancel a Class ===
     109{{{
     110DELETE FROM Class WHERE id_class = :id_class;
     111}}}
     112Completely removes the class from the schedule.
     113
     114=== Update Class Timing ===
     115{{{
     116UPDATE Class
     117SET start_time = :new_start_time,
     118    end_time = :new_end_time,
     119    duration = TIMESTAMPDIFF(MINUTE, :new_start_time, :new_end_time)
     120WHERE id_class = :id_class;
     121}}}
     122Updates the class timing dynamically.
     123
     124---
     125
     126== Conclusion ==
     127This **step-by-step process** allows teachers to: 
     128✔ Log in to the system. 
     129✔ View their subjects and assigned classes. 
     130✔ Create new classes and link them to courses. 
     131✔ View and manage their schedule.