| Field | Details |
|---|---|
| Project Title | Student Grade Tracker Website |
| Student Name | Aldane Hutchinson |
| Date | Mar 30,2026 |
| Student ID | 2502150 |
| Teacher | Wayne thompson |
| Course | CNS1001 β Introduction to Programming |
| Semester | Semester 2, 2026 |
| Due Date | April 17, 2026 |
| Backend | Python 3 with Flask framework |
| Frontend | HTML5, CSS3, Vanilla JavaScript |
| Data Storage | Plain text file β data/grades.txt |
| Main Program File | CNS1001_Project2_AldaneHutchinson_2502150_project.py |
Students in Jamaica preparing for CAPE and CXC examinations regularly use past papers as a revision tool. A common challenge is that after completing a paper and checking the answers, the student has a raw score but no structured record of it. Without tracking scores across subjects and over time, it is difficult to identify which subjects need the most attention, whether performance is improving, or which individual subjects are being consistently failed.
The Student Grade Tracker Website was built to solve this problem. It gives students a simple browser-based tool to add, view, edit, delete, and search their subject grades. Every grade is saved to a text file so the data is available every time the application is opened. The web interface makes the program accessible and straightforward to use without needing to understand command-line tools.
The Student Grade Tracker is a full-stack web application. The backend is written in Python using the Flask framework, which handles routing, business logic, input validation, and file storage. The frontend is built with HTML5 for structure, CSS3 for styling and layout, and Vanilla JavaScript for real-time form validation, table sorting, and interactive feedback. Grades are stored in a plain text file at data/grades.txt inside the project folder.
The application runs locally on the student's computer. The user opens a browser, navigates to http://127.0.0.1:5000, and uses the web interface to manage their grades. No internet connection is required once the application is running.
This section outlines the main features of the Student Grade Tracker system and how each one functions.
- Displays the main navigation menu with four feature cards
- Shows the total number of subjects being tracked
- Displays flash messages confirming completed actions
- Provides a form to enter:
- Subject name
- Numeric grade (0β100)
- Validation:
- Frontend (JavaScript) checks input before submission
- Backend (Flask) validates again before saving
- Prevents duplicate subject entries
- Displays all saved grades in a table format
- Shows:
- Subject name
- Numeric grade
- Letter classification (AβF)
- Pass/Fail status
- Features:
- Colour-coded rows based on performance
- Edit and Delete buttons
- Clickable column headers for sorting
- Displays overall performance analysis:
- Average grade
- Highest and lowest grades
- Pass/Fail status
- Total number of subjects
- Passing and failing counts
- Pass rate
- Includes a detailed per-subject breakdown table
- Allows users to search using part of a subject name
- Displays matching results with:
- Grade
- Classification
- Status
- Includes Edit and Delete options directly from results
- Displays a pre-filled form with the current grade
- Allows user to update the value
- Automatically recalculates:
- Grade classification
- Pass/Fail status
- Removes a subject and its grade from records
- Includes a confirmation dialog before deletion
- Provides user feedback after every action
- Message types:
- β Success
- β Error
- βΉοΈ Information
- Displayed at the top of each page
This section explains the key programming concepts used in the development of the Student Grade Tracker system and how each was applied.
Each feature of the system is implemented using separate functions to improve organization and reusability.
Functions are used to organise the system into reusable and manageable components.
These functions handle user navigation and interaction with the system:
home()β Displays the home pageadd_grade()β Handles adding a new gradeview_grades()β Displays all saved gradesresults()β Shows statistics and analysissearch()β Searches for a subjectedit_grade()β Updates an existing gradedelete_grade()β Removes a subject
These functions handle data processing and validation:
-
read_grades()β Reads data from file -
save_grades()β Saves data to file -
validate_grade()β Ensures grade is valid -
validate_subject()β Ensures subject name is valid -
calculate_average()β Computes average grade -
get_highest_grade()β Finds highest score -
get_lowest_grade()β Finds lowest score -
get_grade_classification()β Assigns letter grade (AβF) -
check_pass_fail()β Determines pass or fail status
if, elif, and else statements are used to control program logic.
- Determine pass or fail status
- Assign letter grade classifications
- Validate user inputs
- Detect duplicate subjects
- Handle cases where no grades are available
for loops are used to process collections of data.
- Iterate through grades to calculate the average
- Find the highest and lowest grades
- Assign classifications to each subject
- Build the data structure for displaying results
Data is stored using a list of dictionaries.
- Each record contains:
subjectgrade
- The list is recreated from the file when reading data and updated when saving
The system uses file handling to store and retrieve data.
read_grades()reads fromdata/grades.txtand converts each line into a dictionarysave_grades()writes updated data back to the file- The
data/folder is created automatically usingos.makedirs()
Validation ensures that all user inputs are correct before processing.
-
validate_grade():- Uses
try/exceptto handle non-numeric input - Ensures the grade is between 0 and 100
- Uses
-
validate_subject():- Ensures the subject is not empty
- Limits length to 100 characters
- Prevents use of commas
Flask is used to manage navigation and user interaction.
- Routes are defined using
@app.route() - Some routes support form submission using
methods=['GET', 'POST'] - Dynamic routes like
<subject>are used for editing and deleting records
Flash messages provide feedback to the user.
flash()is used to display:- Success messages
- Error messages
- Informational messages
app.secret_keyenables session management required for flash messages
This section explains how HTML and templating are used to structure and dynamically display content in the Student Grade Tracker system.
Jinja2 is used to connect Python data with HTML pages.
{{ variable }}displays dynamic data from Flask{% for %}loops generate table rows dynamically{% if %}conditionals:- Show pass/fail badges
- Apply colour-coded rows
- Display empty-state messages when no data is available
Forms are used to collect user input and send it to the backend.
- Pages using forms:
add_grade.htmledit_grade.htmlsearch.html
- Forms use the
POSTmethod for secure data submission - Input fields use the
nameattribute:- Matches keys accessed in Flask using
request.form.get()
- Matches keys accessed in Flask using
Ensures correct linking between pages and resources.
- Used for:
- Navigation links
- Form actions
- Static files (CSS, JavaScript)
- Automatically generates correct URLs regardless of deployment environment
This section explains how CSS is used to design and enhance the visual appearance and responsiveness of the Student Grade Tracker system.
CSS Grid is used to create a flexible and responsive layout.
- Home page navigation uses:
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) - Automatically adjusts the number of columns based on screen size
- Ensures a clean card-based layout across devices
Animations improve user experience by making the interface more dynamic.
fadeInβ smooth page loading effectslideDownβ header appearanceslideInβ navigation elementsfadeInUpβ content and cards
Colours are used to visually communicate results.
- Pass rows: Green left border (
pass-row) - Fail rows: Red left border (
fail-row) - Result card:
- Green gradient β PASS
- Red gradient β FAIL
Ensures the system works well on different screen sizes.
@media (max-width: 768px)used for mobile devices- Changes grid layout to a single column
- Reduces padding for smaller screens
- Adjusts font sizes for readability
This section explains how JavaScript is used to enhance interactivity and user experience in the Student Grade Tracker system.
JavaScript dynamically updates and controls elements on the web page.
DOMContentLoadedensures all scripts run after the page is fully loaded- Dynamic elements created:
- Loading overlay
- Toast notifications
- Results progress bar
Real-time validation ensures correct user input before submission.
validateSubjectInput()checks subject name rulesvalidateGradeInput()ensures valid numeric grade- Error messages displayed using:
<span class="error-message">
- Final validation occurs before submitting data to Flask
Event listeners handle user interactions.
inputevents β real-time validationclickevents β sorting table columnssubmitevent β final form validation before sending data
Sorting improves data organisation and usability.
sortTable(columnIndex):- Reads all table rows
- Sorts data alphabetically or numerically
- Re-renders table in sorted order
Improves user experience by removing alerts automatically.
.alertmessages fade out after page loadsetTimeoutremoves alerts after 10 seconds
Visual representation of performance on the results page.
createProgressBar()generates a coloured bar- Color indicators:
- π’ Green β 70% and above
- π‘ Yellow β 50%β69%
- π΄ Red β below 50%
- Python 3.7 or higher
- Flask (install using the command below)
- A modern web browser (Chrome, Firefox, or Edge)
Step 1 β Extract the ZIP file and open the grade_tracker folder.
Step 2 β Open a terminal inside the grade_tracker folder.
On Windows, click the address bar in the folder, type cmd, and press Enter.
Your terminal path should end with:
...\grade_tracker>
Step 3 β Install Flask:
pip install flask
Step 4 β Run the application:
cd CNS1001_Project2_AldaneHutchinson_2502150_grade_tracker
python CNS1001_Project2_AldaneHutchinson_2502150_project.py
Step 5 β Open your browser and go to:
http://127.0.0.1:5000
Step 6 β To stop the application, go back to the terminal and press Ctrl + C.
The
data/grades.txtfile is created automatically on the first run. No manual setup is needed.
CNS1001_Project2_AldaneHutchinson_2502150_grade_tracker/
βββ CNS1001_Project2_AldaneHutchinson_2502150_app.py
βββ CNS1001_Project2_AldaneHutchinson_2502150_requirements.txt
βββ CNS1001_Project2_AldaneHutchinson_2502150_README.md
βββ templates/
β βββ index.html β Home page
β βββ add_grade.html β Add grade form
β βββ view_grades.html β View all grades
β βββ edit_grade.html β Edit grade form
β βββ result.html β Results & statistics
β βββ search.html β Search by subject
βββ static/
β βββ css/
β β βββ style.css β Main stylesheet
β βββ js/
β βββ main.js β JavaScript
βββ data/
βββ grades.txt β Created automatically on first run
| URL | Page Name | Description |
|---|---|---|
/ |
Home | Displays main menu and grade count |
/add |
Add Grade | Form to input a new subject and grade |
/view |
View Grades | Shows all saved grades in a table |
/results |
Results | Displays average, statistics, and pass/fail summary |
/search |
Search | Search for a subject by name |
/edit/<subject> |
Edit Grade | Update an existing subjectβs grade |
/delete/<subject> |
Delete | Remove a subject and redirect to View Grades |
Input:
| Field | Value |
|---|---|
| Subject Name | Mathematics |
| Grade (%) | 85 |
Output (flash message on home page):
Grade for Mathematics (85%) added successfully!
| # | Subject | Grade (%) | Classification | Status | Actions |
|---|---|---|---|---|---|
| 1 | Mathematics | 85.0 | B | β PASS | Edit / Delete |
| 2 | Biology | 72.0 | C | β PASS | Edit / Delete |
| 3 | Chemistry | 45.0 | F | β FAIL | Edit / Delete |
Summary card below the table:
Total Subjects: 3
Average Grade: 67.3%
| Statistic | Value |
|---|---|
| Average Grade | 67.3% (PASS) |
| Highest Grade | 85.0% β Mathematics |
| Lowest Grade | 45.0% β Chemistry |
| Total Subjects | 3 |
| Passing Subjects | 2 |
| Failing Subjects | 1 |
| Pass Rate | 66.7% |
Input: math (case insensitive)
Output:
Subject: Mathematics
Grade: 85.0%
Classification: B
Status: PASS
If no match found:
No subject found containing "physics"
Grade above 100:
Grade must be between 0 and 100
Empty subject name:
Subject name cannot be empty
Duplicate subject:
Subject "Mathematics" already exists. Use Edit to update it.
This section outlines the test cases conducted to ensure that the Student Grade Tracker system functions correctly. Each test verifies different features such as input validation, data management, and system responses.
- Input: Subject: Mathematics | Grade: 85
- Expected Output: Grade added successfully. Redirects to home.
- **Actual Output:Grade for Mathematics (85%) added successfully!
- **Result:pass
- Input: Subject: Biology | Grade: 150
- Expected Output: Error: Grade must be between 0 and 100.
- **Actual Output:*Enter a grade between 0 and 100 Add Grade *
- **Result:fail
- Input: Subject: Chemistry | Grade: abc
- Expected Output: Error: the program does not allowed letters to be enter.
- Actual Output: (null)
- **Result:fail
- Input: Subject: (blank) | Grade: 70
- Expected Output: Error: Subject name cannot be empty.
- Actual Output: (Pls fill out the feild. the html form require it to be fill or else it will send the form data back to file or flash messages)
- **Result:fail
- Input: Subject: Mathematics | Grade: 90
- Expected Output: Error: Subject already exists. Use Edit.
- **Actual Output:Subject "Mathematics" already exists. Use Edit to update it.
- **Result:fail
- Input: Navigate to
/view - Expected Output: Displays all subjects with grade, classification, and status.
- Actual Output: Has a summary of subjects and total average calcualted so far with classification, and status
- **Result:Pass
- Input: Search: math
- Expected Output: Displays the grade for math whether of pass of Fial.
- **Actual Output:Pass
- Result: Pass
- Input: Search: physics
- Expected Output: No subject found containing "physics".
- **Actual Output:No subject found containing "physics" and also option to add a grade
- **Result:Fail
- Input: Edit Mathematics | New Grade: 92
- Expected Output: Grade updated to 92%. Redirects to View Grades.
- **Actual Output:Grade for Mathematics updated to 92.0%
- **Result:pass
- Input: Edit Mathematics | New Grade: -5
- Expected Output: Error: Grade must be between 0 and 100.
- **Actual Output:Grade must be between 0 and 100 and html form validation value must greater than 0
- **Result:fail
- Input: Delete Mathematics (confirm)
- Expected Output: Successfully deleted Mathematics.
- **Actual Output:Are you sure you want to delete Mathematics? and Successfully deleted Mathematicsand then defaults no grades added as yet
- **Result:Pass
- Input: Navigate to
/resultswith empty file - Expected Output: No grades available. Redirects to home.
- **Actual Output:No grades available. Please add some grades first. Redirects to home page
- **Result:Pass
The biggest conceptual challenge at the start was understanding how the Python backend and the HTML frontend communicate. Flask does not serve HTML directly from a file path. The HTML files must be inside a folder named templates/, the CSS and JavaScript files must be inside a folder named static/, and every link in the HTML must use url_for() rather than a simple relative file path. Getting this structure right was essential before any page would load.
Flash messages in Flask depend on the session system, which requires a secret key to be set on the app object. Without app.secret_key, the flash() function raises a RuntimeError and no messages appear. Once the secret key was added, flash messages worked correctly across all pages.
Grades are saved in a comma-separated format in grades.txt. During testing it was found that if a subject name contained a comma, the read_grades() function would split the line at the wrong position and produce corrupted data. This was fixed by adding a comma check to validate_subject() so any subject name containing a comma is rejected with a clear error message before it is saved.
The program uses both client-side validation in JavaScript and server-side validation in Python. JavaScript catches errors immediately as the user types, giving faster feedback without a round trip to the server. Python validates the same fields again when the form is submitted in case JavaScript was disabled or bypassed. Keeping both layers consistent required careful alignment between what the JavaScript checks and what the Flask route checks.
Challenge 5 β Running python flask website and downloading required software. Ex Flask updated version
To run the website it took time to learn how to do and also to executed and run the website in terminal. needed cd grade_tracker to go directly in folder where CNS1001_Project2_AldaneHutchinson_2502150_project.py is to run the application and flask version needed an update from the code provided from deepseek and it needed error fixing with claude and developer to fix the problem. the application with python CNS1001_Project2_AldaneHutchinson_2502150_project.py,and was then open to browser http://127.0.0.1:5000 .
- Flask's folder structure is strict. HTML templates must be in
templates/and static files must be instatic/. Placing them anywhere else causes aTemplateNotFounderror or a 404 for CSS and JavaScript files. - The
<script>tag must be placed at the end of the<body>element, not after the closing</body>tag. Placing it outside the body produces invalid HTML. - Separating validation into its own functions (
validate_grade()andvalidate_subject()) made it easy to call the same checks from both the add route and the edit route without duplicating code. - Testing with edge cases such as an empty grades file, a grade of exactly 0, and a grade of exactly 100 is important. All three produced correct results but would not have been confirmed without specific test cases.
- Breaking the application into small, clearly named functions makes debugging much faster. When a bug appeared in the results calculation, only the relevant calculation functions needed to be examined rather than the entire application.
The use of AI was implemented for the project ChatGPT for design and ideas, DeepSeek for code, and Claude for fixing errors. Both the developer and ai work together to do the project. The developer has experience with web development. A document is there containing some of the prompts the developer used to assist in making the projects.