Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ def init_db():
# Insert default departments if not exists
default_departments = [
("CSE", "Computer Science and Engineering"),
("AI", "Artificial Intelligence"),
("EE", "Electrical Engineering"),
("CHEMICAL", "Chemical Engineering"),
("ECE", "Electronics and Communication Engineering"),
("EEE", "Electrical and Electronics Engineering"),
("MECH", "Mechanical Engineering"),
Expand Down
6 changes: 6 additions & 0 deletions templates/student_new_2.html
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,13 @@ <h1>Create an Account</h1>
<option disabled selected value="">Select Department</option>
<option value="CSE">CSE</option>
<option value="CSE(E Tech)">CSE(E Tech)</option>
<option value="AI">AI</option>
<option value="IT">IT</option>
<option value="EEE">EEE</option>
<option value="ECE">ECE</option>
<option value="EE">EE</option>
<option value="CIVIL">CIVIL</option>
<option value="CHEMICAL">CHEMICAL</option>
Comment on lines +701 to +707

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR BUG Add AI, EE, and CHEMICAL to default_departments in app.py

The admin /admin/departments page counts students via LEFT JOIN student s ON d.dept_code = s.student_dept (app.py:1043), so only dept codes present in the departments table are counted. default_departments (app.py:217–223) includes CIVIL but not AI, EE, or CHEMICAL — students registering with those three departments will be silently invisible in admin department statistics.

Prompt to fix with AI

Copy this prompt into your AI coding assistant to fix this issue.

In `app.py`, around line 217, the `default_departments` list is missing three department codes that were just added to the registration form in `templates/student_new_2.html`. Add the following tuples to the `default_departments` list:
  ("AI", "Artificial Intelligence"),
  ("EE", "Electrical Engineering"),
  ("CHEMICAL", "Chemical Engineering"),
Without these entries, the admin departments statistics page (`/admin/departments`) will silently exclude all students who register with AI, EE, or CHEMICAL because it uses a LEFT JOIN from the `departments` table (keyed on `dept_code`) to the `student` table.

<option value="MECH">MECH</option>
</select>
</div>
Expand Down