From f32d05d81a584ada25ea18ea9d74335ee04860d4 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Thu, 3 Sep 2026 20:04:03 -0400 Subject: [PATCH 01/12] I updated the dump process to handle 3 new course fields: Prerequisites, Typically Offered, and Contact Hours. --- tools/processDump.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/processDump.php b/tools/processDump.php index 1277d2f..405e7ab 100644 --- a/tools/processDump.php +++ b/tools/processDump.php @@ -102,6 +102,9 @@ `acad_career` varchar(4) NOT NULL, `instruction_mode` varchar(2) NOT NULL, `course_descrlong` text NOT NULL, + `prereqs` text NOT NULL, + `typ_offr` text NOT NULL, + `ctc_hrs` text NOT NULL, PRIMARY KEY (`crse_id`,`crse_offer_nbr`,`strm`,`session_code`,`class_section`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; ENE; @@ -112,7 +115,7 @@ $parser->halt(["Error: Failed to create temporary class table", mysqli_error($dbConn)]); } -$parser->fileToTempTable("classes", $classFile, 24, $classSize, "procClassArray"); +$parser->fileToTempTable("classes", $classFile, 27, $classSize, "procClassArray"); fclose($classFile); // Build a temporary table for the meeting patterns @@ -266,9 +269,8 @@ $failures++; } $departmentsProc = mysqli_affected_rows($dbConn); - // Grab each COURSE from the classes table -$courseQuery = "SELECT strm, subject, units, acad_org, catalog_nbr, descr, course_descrlong,"; +$courseQuery = "SELECT strm, subject, units, acad_org, catalog_nbr, descr, course_descrlong, prereqs, typ_offr, ctc_hrs"; $courseQuery .= " crse_id, crse_offer_nbr, session_code"; $courseQuery .= " FROM classes WHERE strm < 20130 GROUP BY crse_id, strm, session_code"; $parser->debug("... Updating courses\n0%", false); @@ -298,10 +300,13 @@ // Escape the necessary fields $row['descr'] = mysqli_real_escape_string($dbConn, $row['descr']); $row['course_descrlong'] = mysqli_real_escape_string($dbConn, $row['course_descrlong']); + $row['prereqs'] = mysqli_real_escape_string($dbConn, $row['prereqs']); + $row['typ_offr'] = mysqli_real_escape_string($dbConn, $row['typ_offr']); + $row['ctc_hrs'] = mysqli_real_escape_string($dbConn, $row['ctc_hrs']); // Insert or update the course @$courseId = $parser->insertOrUpdateCourse($row['qtr'], $row['acad_org'], $row['subject'], $row['catalog_nbr'], - (int)$row['units'], $row['descr'], $row['course_descrlong']); + (int)$row['units'], $row['descr'], $row['course_descrlong'], $row['prereqs'], $row['typ_offr'], $row['ctc_hrs']); if (!is_numeric($courseId)) { echo(" *** Error: Failed to update {$row['qtr']} {$row['subject']}-{$row['catalog_nbr']}\n"); echo(" "); From 89e152d05898f3e8946beef2d70cdc43611675f3 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Thu, 3 Sep 2026 20:25:05 -0400 Subject: [PATCH 02/12] I added the new column to the CREATE TABLE statement. --- schema/tables/courses.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/schema/tables/courses.sql b/schema/tables/courses.sql index 288af60..9c4371d 100644 --- a/schema/tables/courses.sql +++ b/schema/tables/courses.sql @@ -15,7 +15,10 @@ CREATE TABLE courses ( `course` VARCHAR(4) NOT NULL, `credits` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, `title` VARCHAR(50) NOT NULL, - `description` TEXT NOT NULL + `description` TEXT NOT NULL, + `prerequisites` TEXT NOT NULL, + `typically_offered` TEXT NOT NULL, + `contact_hours` TEXT NOT NULL )ENGINE=InnoDb; -- INDEXING ---------------------------------------------------------------- From f87acfcc850f8f41d9ab579e8042918ccf8053d8 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Thu, 3 Sep 2026 20:55:01 -0400 Subject: [PATCH 03/12] Updated the insertOrUpdateCourse code. --- schema/migrationScripts/f_4charcourses.sql | 11 +++++++---- schema/procedures/InsertOrUpdateCourse.sql | 11 +++++++---- tools/Parser.php | 23 ++++++++++++---------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/schema/migrationScripts/f_4charcourses.sql b/schema/migrationScripts/f_4charcourses.sql index 047147b..429431e 100644 --- a/schema/migrationScripts/f_4charcourses.sql +++ b/schema/migrationScripts/f_4charcourses.sql @@ -19,7 +19,10 @@ CREATE PROCEDURE InsertOrUpdateCourse( IN p_course VARCHAR(4), IN p_credits INT, IN p_title VARCHAR(50), - IN p_description TEXT + IN p_description TEXT, + IN p_prerequisites TEXT, + IN p_typically_offered TEXT, + IN p_contact_hours TEXT, ) BEGIN -- Determine if the course already exists @@ -52,13 +55,13 @@ CREATE PROCEDURE InsertOrUpdateCourse( IF recordFound > 0 THEN -- Course exists, so update it UPDATE courses AS c - SET c.title = p_title, c.description = p_description, c.credits = p_credits + SET c.title = p_title, c.description = p_description, c.credits = p_credits, c.prerequisites = p_prerequisites, c.typically_offered = p_typically_offered, c.contact_hours = p_contact_hours WHERE c.department = v_department AND course = p_course AND quarter = p_quarter; SELECT "updated" AS action; ELSE -- Course doesn't exist, so insert it - INSERT INTO courses (quarter, department, course, title, description, credits) - VALUES(p_quarter, v_department, p_course, p_title, p_description, p_credits); + INSERT INTO courses (quarter, department, course, title, description, credits, prerequisites, typically_offered, contact_hours) + VALUES(p_quarter, v_department, p_course, p_title, p_description, p_credits, p_prerequisites, p_typically_offered, p_contact_hours); SELECT "inserted" AS action; END IF; diff --git a/schema/procedures/InsertOrUpdateCourse.sql b/schema/procedures/InsertOrUpdateCourse.sql index b9d78d5..82f4790 100644 --- a/schema/procedures/InsertOrUpdateCourse.sql +++ b/schema/procedures/InsertOrUpdateCourse.sql @@ -7,7 +7,10 @@ CREATE PROCEDURE InsertOrUpdateCourse( IN p_course VARCHAR(4), IN p_credits INT, IN p_title VARCHAR(50), - IN p_description TEXT + IN p_description TEXT, + IN p_prerequisites TEXT, + IN p_typically_offered TEXT, + IN p_contact_hours TEXT, ) BEGIN -- Determine if the course already exists @@ -40,13 +43,13 @@ BEGIN IF recordFound > 0 THEN -- Course exists, so update it UPDATE courses AS c - SET c.title = p_title, c.description = p_description, c.credits = p_credits + SET c.title = p_title, c.description = p_description, c.credits = p_credits, c.prerequisites = p_prerequisites, c.typically_offered = p_typically_offered, c.contact_hours = p_contact_hours WHERE c.department = v_department AND course = p_course AND quarter = p_quarter; SELECT "updated" AS action; ELSE -- Course doesn't exist, so insert it - INSERT INTO courses (quarter, department, course, title, description, credits) - VALUES(p_quarter, v_department, p_course, p_title, p_description, p_credits); + INSERT INTO courses (quarter, department, course, title, description, credits, prerequisites, typically_offered, contact_hours) + VALUES(p_quarter, v_department, p_course, p_title, p_description, p_credits, p_prerequisites, p_typically_offered, p_contact_hours); SELECT "inserted" AS action; END IF; diff --git a/tools/Parser.php b/tools/Parser.php index 8ac19b8..6602a13 100644 --- a/tools/Parser.php +++ b/tools/Parser.php @@ -86,28 +86,31 @@ function halt($messages) { /** * Inserts or updates a course. This function calls the stored procedure for * inserting or updating a course. - * @param $quarter int The term that the course is in - * @param $departCode string The code of the department - * @param $classCode string The code for the class - * @param $course string The number of the course - * @param $credits int The credits the course offers - * @param $title string The title of the course - * @param $description string The description for the course + * @param $quarter int The term that the course is in + * @param $departCode string The code of the department + * @param $classCode string The code for the class + * @param $course string The number of the course + * @param $credits int The credits the course offers + * @param $title string The title of the course + * @param $description string The description for the course + * @param $prerequisites string The prerequisites for the course + * @param $typicallyOffered string The typically offered semester for the course + * @param $contactHours string The contact hours for the course * @return mixed String of error message returned on failure. * Integer of course ID returned on success */ - function insertOrUpdateCourse(int $quarter, string $departCode, string $classCode, string $course, int $credits, string $title, string $description) { + function insertOrUpdateCourse(int $quarter, string $departCode, string $classCode, string $course, int $credits, string $title, string $description, string $prerequisites, string $typicallyOffered, string $contactHours) { global $coursesUpdated, $coursesAdded; // Call the stored proc // TODO: Refactor out department ID number (0000) - $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}')"; + $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours})"; $success = mysqli_multi_query($this->dbConn, $query); // Catch errors or return the id if (!$success) { // If the class code errors out, try the department code // TODO: Refactor out department ID number (0000) - $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}')"; + $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours})"; $success = mysqli_multi_query($this->dbConn, $query); if (!$success) { return mysqli_error($this->dbConn); From d3727524d2794f0d4a5bd8f1eae209f05947ed13 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Thu, 3 Sep 2026 20:57:08 -0400 Subject: [PATCH 04/12] Fixed syntax errors. --- schema/migrationScripts/f_4charcourses.sql | 2 +- schema/procedures/InsertOrUpdateCourse.sql | 2 +- tools/Parser.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/migrationScripts/f_4charcourses.sql b/schema/migrationScripts/f_4charcourses.sql index 429431e..794b8bc 100644 --- a/schema/migrationScripts/f_4charcourses.sql +++ b/schema/migrationScripts/f_4charcourses.sql @@ -22,7 +22,7 @@ CREATE PROCEDURE InsertOrUpdateCourse( IN p_description TEXT, IN p_prerequisites TEXT, IN p_typically_offered TEXT, - IN p_contact_hours TEXT, + IN p_contact_hours TEXT ) BEGIN -- Determine if the course already exists diff --git a/schema/procedures/InsertOrUpdateCourse.sql b/schema/procedures/InsertOrUpdateCourse.sql index 82f4790..ff4c1ec 100644 --- a/schema/procedures/InsertOrUpdateCourse.sql +++ b/schema/procedures/InsertOrUpdateCourse.sql @@ -10,7 +10,7 @@ CREATE PROCEDURE InsertOrUpdateCourse( IN p_description TEXT, IN p_prerequisites TEXT, IN p_typically_offered TEXT, - IN p_contact_hours TEXT, + IN p_contact_hours TEXT ) BEGIN -- Determine if the course already exists diff --git a/tools/Parser.php b/tools/Parser.php index 6602a13..6ab3bb1 100644 --- a/tools/Parser.php +++ b/tools/Parser.php @@ -103,14 +103,14 @@ function insertOrUpdateCourse(int $quarter, string $departCode, string $classCod global $coursesUpdated, $coursesAdded; // Call the stored proc // TODO: Refactor out department ID number (0000) - $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours})"; + $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours}')"; $success = mysqli_multi_query($this->dbConn, $query); // Catch errors or return the id if (!$success) { // If the class code errors out, try the department code // TODO: Refactor out department ID number (0000) - $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours})"; + $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours}')"; $success = mysqli_multi_query($this->dbConn, $query); if (!$success) { return mysqli_error($this->dbConn); From dcf69107d3e4d918045cbbde8287b5eed61b214c Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Tue, 8 Sep 2026 21:14:00 -0400 Subject: [PATCH 05/12] Changing contact hours to float. --- schema/migrationScripts/f_4charcourses.sql | 2 +- schema/procedures/InsertOrUpdateCourse.sql | 2 +- schema/tables/courses.sql | 2 +- tools/Parser.php | 4 ++-- tools/processDump.php | 5 ++--- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/schema/migrationScripts/f_4charcourses.sql b/schema/migrationScripts/f_4charcourses.sql index 794b8bc..e9f9fe6 100644 --- a/schema/migrationScripts/f_4charcourses.sql +++ b/schema/migrationScripts/f_4charcourses.sql @@ -22,7 +22,7 @@ CREATE PROCEDURE InsertOrUpdateCourse( IN p_description TEXT, IN p_prerequisites TEXT, IN p_typically_offered TEXT, - IN p_contact_hours TEXT + IN p_contact_hours FLOAT ) BEGIN -- Determine if the course already exists diff --git a/schema/procedures/InsertOrUpdateCourse.sql b/schema/procedures/InsertOrUpdateCourse.sql index ff4c1ec..2d0ce9c 100644 --- a/schema/procedures/InsertOrUpdateCourse.sql +++ b/schema/procedures/InsertOrUpdateCourse.sql @@ -10,7 +10,7 @@ CREATE PROCEDURE InsertOrUpdateCourse( IN p_description TEXT, IN p_prerequisites TEXT, IN p_typically_offered TEXT, - IN p_contact_hours TEXT + IN p_contact_hours FLOAT ) BEGIN -- Determine if the course already exists diff --git a/schema/tables/courses.sql b/schema/tables/courses.sql index 9c4371d..d622575 100644 --- a/schema/tables/courses.sql +++ b/schema/tables/courses.sql @@ -18,7 +18,7 @@ CREATE TABLE courses ( `description` TEXT NOT NULL, `prerequisites` TEXT NOT NULL, `typically_offered` TEXT NOT NULL, - `contact_hours` TEXT NOT NULL + `contact_hours` FLOAT UNSIGNED NOT NULL )ENGINE=InnoDb; -- INDEXING ---------------------------------------------------------------- diff --git a/tools/Parser.php b/tools/Parser.php index 6ab3bb1..d62566b 100644 --- a/tools/Parser.php +++ b/tools/Parser.php @@ -95,11 +95,11 @@ function halt($messages) { * @param $description string The description for the course * @param $prerequisites string The prerequisites for the course * @param $typicallyOffered string The typically offered semester for the course - * @param $contactHours string The contact hours for the course + * @param $contactHours float The contact hours for the course * @return mixed String of error message returned on failure. * Integer of course ID returned on success */ - function insertOrUpdateCourse(int $quarter, string $departCode, string $classCode, string $course, int $credits, string $title, string $description, string $prerequisites, string $typicallyOffered, string $contactHours) { + function insertOrUpdateCourse(int $quarter, string $departCode, string $classCode, string $course, int $credits, string $title, string $description, string $prerequisites, string $typicallyOffered, float $contactHours) { global $coursesUpdated, $coursesAdded; // Call the stored proc // TODO: Refactor out department ID number (0000) diff --git a/tools/processDump.php b/tools/processDump.php index 405e7ab..b3d5071 100644 --- a/tools/processDump.php +++ b/tools/processDump.php @@ -104,7 +104,7 @@ `course_descrlong` text NOT NULL, `prereqs` text NOT NULL, `typ_offr` text NOT NULL, - `ctc_hrs` text NOT NULL, + `ctc_hrs` float NOT NULL, PRIMARY KEY (`crse_id`,`crse_offer_nbr`,`strm`,`session_code`,`class_section`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; ENE; @@ -302,11 +302,10 @@ $row['course_descrlong'] = mysqli_real_escape_string($dbConn, $row['course_descrlong']); $row['prereqs'] = mysqli_real_escape_string($dbConn, $row['prereqs']); $row['typ_offr'] = mysqli_real_escape_string($dbConn, $row['typ_offr']); - $row['ctc_hrs'] = mysqli_real_escape_string($dbConn, $row['ctc_hrs']); // Insert or update the course @$courseId = $parser->insertOrUpdateCourse($row['qtr'], $row['acad_org'], $row['subject'], $row['catalog_nbr'], - (int)$row['units'], $row['descr'], $row['course_descrlong'], $row['prereqs'], $row['typ_offr'], $row['ctc_hrs']); + (int)$row['units'], $row['descr'], $row['course_descrlong'], $row['prereqs'], $row['typ_offr'], (float)$row['ctc_hrs']); if (!is_numeric($courseId)) { echo(" *** Error: Failed to update {$row['qtr']} {$row['subject']}-{$row['catalog_nbr']}\n"); echo(" "); From 511cc3f1dc3a74aa109dff0438f5824a8be9db92 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Tue, 8 Sep 2026 21:30:32 -0400 Subject: [PATCH 06/12] I added a new script, but idk if I should have NOT NULL or not. --- schema/migrationScripts/course-extension.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 schema/migrationScripts/course-extension.sql diff --git a/schema/migrationScripts/course-extension.sql b/schema/migrationScripts/course-extension.sql new file mode 100644 index 0000000..3ae19d3 --- /dev/null +++ b/schema/migrationScripts/course-extension.sql @@ -0,0 +1,11 @@ +-- ------------------------------------------------------------------------- +-- Migration Script for course-extension +-- +-- @author Nathan Russo (nathanr@csh.rit.edu) +-- @descrip Migration script to add prerequisites, typically offered, and contact hours to the course table. +-- ------------------------------------------------------------------------- + +ALTER TABLE courses + ADD COLUMN prerequisites TEXT, + ADD COLUMN typically_offered TEXT, + ADD COLUMN contact_hours FLOAT UNSIGNED; From ebc680a21c057a6dd0d798fa9c3f31493db1f774 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Tue, 8 Sep 2026 23:54:45 -0400 Subject: [PATCH 07/12] I added defaults. --- schema/migrationScripts/course-extension.sql | 6 +++--- schema/tables/courses.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/schema/migrationScripts/course-extension.sql b/schema/migrationScripts/course-extension.sql index 3ae19d3..aef4ea8 100644 --- a/schema/migrationScripts/course-extension.sql +++ b/schema/migrationScripts/course-extension.sql @@ -6,6 +6,6 @@ -- ------------------------------------------------------------------------- ALTER TABLE courses - ADD COLUMN prerequisites TEXT, - ADD COLUMN typically_offered TEXT, - ADD COLUMN contact_hours FLOAT UNSIGNED; + ADD COLUMN prerequisites TEXT NOT NULL DEFAULT '', + ADD COLUMN typically_offered TEXT NOT NULL DEFAULT '', + ADD COLUMN contact_hours FLOAT UNSIGNED NOT NULL DEFAULT 0; diff --git a/schema/tables/courses.sql b/schema/tables/courses.sql index d622575..26a500c 100644 --- a/schema/tables/courses.sql +++ b/schema/tables/courses.sql @@ -16,9 +16,9 @@ CREATE TABLE courses ( `credits` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, `title` VARCHAR(50) NOT NULL, `description` TEXT NOT NULL, - `prerequisites` TEXT NOT NULL, - `typically_offered` TEXT NOT NULL, - `contact_hours` FLOAT UNSIGNED NOT NULL + `prerequisites` TEXT NOT NULL DEFAULT "", + `typically_offered` TEXT NOT NULL DEFAULT "", + `contact_hours` FLOAT UNSIGNED NOT NULL DEFAULT 0 )ENGINE=InnoDb; -- INDEXING ---------------------------------------------------------------- From 5dfc98ddad0774cb735bfc3c5315dbecc7400263 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Tue, 8 Sep 2026 23:56:01 -0400 Subject: [PATCH 08/12] I missed this file... --- schema/tables/courses.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema/tables/courses.sql b/schema/tables/courses.sql index 26a500c..aa243b5 100644 --- a/schema/tables/courses.sql +++ b/schema/tables/courses.sql @@ -16,8 +16,8 @@ CREATE TABLE courses ( `credits` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0, `title` VARCHAR(50) NOT NULL, `description` TEXT NOT NULL, - `prerequisites` TEXT NOT NULL DEFAULT "", - `typically_offered` TEXT NOT NULL DEFAULT "", + `prerequisites` TEXT NOT NULL DEFAULT '', + `typically_offered` TEXT NOT NULL DEFAULT '', `contact_hours` FLOAT UNSIGNED NOT NULL DEFAULT 0 )ENGINE=InnoDb; From e9f6c7384c280acd79068f0d274a951ee7223095 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Wed, 9 Sep 2026 16:04:38 -0400 Subject: [PATCH 09/12] I was able to get ScheduleMaker to build. --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8fa94a8..b577484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/node:12-buster-slim as builder +FROM docker.io/node:12-buster-slim AS builder LABEL author="Devin Matte " WORKDIR /usr/src/schedule @@ -14,7 +14,8 @@ RUN npm run-script build FROM docker.io/php:7.3-apache LABEL author="Devin Matte " -RUN echo "deb-src http://archive.debian.org/debian buster main" >> /etc/apt/sources.list +RUN sed -i '/security.debian.org\/debian-security/d' /etc/apt/sources.list && \ + echo "deb-src http://archive.debian.org/debian buster main" >> /etc/apt/sources.list RUN apt-get -yq update && \ apt-get -yq install \ From 92f701ecd4a143b5dd4b1f883cecae4ce1d83451 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Sat, 12 Sep 2026 00:01:17 -0400 Subject: [PATCH 10/12] Updated scripts and php. --- .gitignore | 1 + README.md | 2 +- schema/procedures/InsertOrUpdateCourse.sql | 4 ++-- schema/procedures/InsertOrUpdateSection.sql | 4 ++-- schema/tables/schools.sql | 3 +-- tools/Parser.php | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 32fe1db..8edd44c 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ web.config vwd.webinfo WebEssentials-Settings.json vendor +.vscode diff --git a/README.md b/README.md index 19b0eb1..2018dfc 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Available at [schedule.csh.rit.edu](https://schedule.csh.rit.edu) - If you wish to see images locally, you will also need S3 credentials, either supply your own or reach out. ### Run Locally -In order to run locally youre going to need [docker](https://www.docker.com/). +In order to run locally you're going to need [docker](https://www.docker.com/). ``` docker build -t schedulemaker . diff --git a/schema/procedures/InsertOrUpdateCourse.sql b/schema/procedures/InsertOrUpdateCourse.sql index 2d0ce9c..8a7f14a 100644 --- a/schema/procedures/InsertOrUpdateCourse.sql +++ b/schema/procedures/InsertOrUpdateCourse.sql @@ -45,12 +45,12 @@ BEGIN UPDATE courses AS c SET c.title = p_title, c.description = p_description, c.credits = p_credits, c.prerequisites = p_prerequisites, c.typically_offered = p_typically_offered, c.contact_hours = p_contact_hours WHERE c.department = v_department AND course = p_course AND quarter = p_quarter; - SELECT "updated" AS action; + SELECT 'updated' AS action; ELSE -- Course doesn't exist, so insert it INSERT INTO courses (quarter, department, course, title, description, credits, prerequisites, typically_offered, contact_hours) VALUES(p_quarter, v_department, p_course, p_title, p_description, p_credits, p_prerequisites, p_typically_offered, p_contact_hours); - SELECT "inserted" AS action; + SELECT 'inserted' AS action; END IF; -- Return the id of the course diff --git a/schema/procedures/InsertOrUpdateSection.sql b/schema/procedures/InsertOrUpdateSection.sql index 2fe4ddd..2114340 100644 --- a/schema/procedures/InsertOrUpdateSection.sql +++ b/schema/procedures/InsertOrUpdateSection.sql @@ -25,12 +25,12 @@ BEGIN maxenroll = p_maxenroll, curenroll = p_curenroll WHERE course = p_course AND section = p_section; - SELECT "updated" AS action; + SELECT 'updated' AS action; ELSE -- Section does not exist, so insert it INSERT INTO sections (course, section, title, instructor, type, status, maxenroll, curenroll) VALUES(p_course, p_section, p_title, p_instructor, p_type, p_status, p_maxenroll, p_curenroll); - SELECT "inserted" AS action; + SELECT 'inserted' AS action; END IF; -- Get the id of the section we just inserted or updated diff --git a/schema/tables/schools.sql b/schema/tables/schools.sql index 9ca4beb..1d331f7 100644 --- a/schema/tables/schools.sql +++ b/schema/tables/schools.sql @@ -11,8 +11,7 @@ CREATE TABLE IF NOT EXISTS `schools` ( `id` INT UNSIGNED NOT NULL PRIMARY KEY, `number` tinyint(2) UNSIGNED ZEROFILL NULL DEFAULT NULL, `code` VARCHAR(5) NULL DEFAULT NULL, - `title` varchar(30) NOT NULL, - PRIMARY KEY (`id`) + `title` varchar(30) NOT NULL ) ENGINE=InnoDb; -- ADD INDEXES ------------------------------------------------------------- diff --git a/tools/Parser.php b/tools/Parser.php index d62566b..a67eb59 100644 --- a/tools/Parser.php +++ b/tools/Parser.php @@ -103,14 +103,14 @@ function insertOrUpdateCourse(int $quarter, string $departCode, string $classCod global $coursesUpdated, $coursesAdded; // Call the stored proc // TODO: Refactor out department ID number (0000) - $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours}')"; + $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', {$contactHours})"; $success = mysqli_multi_query($this->dbConn, $query); // Catch errors or return the id if (!$success) { // If the class code errors out, try the department code // TODO: Refactor out department ID number (0000) - $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', '{$contactHours}')"; + $query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', {$contactHours})"; $success = mysqli_multi_query($this->dbConn, $query); if (!$success) { return mysqli_error($this->dbConn); From 0dabe67d9527e098359c11fb674c185516800788 Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Sat, 12 Sep 2026 00:54:56 -0400 Subject: [PATCH 11/12] I fixed a bug with parsing. --- api/entity.php | 7 +++++-- tools/processDump.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/entity.php b/api/entity.php index 2c920f1..6c65549 100644 --- a/api/entity.php +++ b/api/entity.php @@ -40,7 +40,7 @@ } // Do the query - $query = "SELECT c.title, c.course, c.description, c.id, d.number, d.code + $query = "SELECT c.title, c.course, c.description, c.id, d.number, d.code, c.prerequisites, c.typically_offered, c.contact_hours FROM sections AS s JOIN courses AS c ON s.course = c.id JOIN departments AS d ON d.id = c.department @@ -62,7 +62,10 @@ "course" => $course['course'], "department" => ["code" => $course['code'], "number" => $course['number']], "title" => $course['title'], - "description" => htmlentities($course['description']) + "description" => htmlentities($course['description']), + "prerequisites" => $course['prerequisites'], + "typically_offered" => $course['typically_offered'], + "contact_hours" => $course['contact_hours'] ]; } diff --git a/tools/processDump.php b/tools/processDump.php index b3d5071..3b39c35 100644 --- a/tools/processDump.php +++ b/tools/processDump.php @@ -270,7 +270,7 @@ } $departmentsProc = mysqli_affected_rows($dbConn); // Grab each COURSE from the classes table -$courseQuery = "SELECT strm, subject, units, acad_org, catalog_nbr, descr, course_descrlong, prereqs, typ_offr, ctc_hrs"; +$courseQuery = "SELECT strm, subject, units, acad_org, catalog_nbr, descr, course_descrlong, prereqs, typ_offr, ctc_hrs, "; $courseQuery .= " crse_id, crse_offer_nbr, session_code"; $courseQuery .= " FROM classes WHERE strm < 20130 GROUP BY crse_id, strm, session_code"; $parser->debug("... Updating courses\n0%", false); From f24914068436eb7b70659770dd1536365fadbd9f Mon Sep 17 00:00:00 2001 From: NathanRusso Date: Sat, 12 Sep 2026 10:17:21 -0400 Subject: [PATCH 12/12] Tested and added a bit more to my migration script. --- schema/migrationScripts/course-extension.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/schema/migrationScripts/course-extension.sql b/schema/migrationScripts/course-extension.sql index aef4ea8..1d5ed00 100644 --- a/schema/migrationScripts/course-extension.sql +++ b/schema/migrationScripts/course-extension.sql @@ -6,6 +6,6 @@ -- ------------------------------------------------------------------------- ALTER TABLE courses - ADD COLUMN prerequisites TEXT NOT NULL DEFAULT '', - ADD COLUMN typically_offered TEXT NOT NULL DEFAULT '', - ADD COLUMN contact_hours FLOAT UNSIGNED NOT NULL DEFAULT 0; + ADD COLUMN IF NOT EXISTS prerequisites TEXT NOT NULL DEFAULT '', + ADD COLUMN IF NOT EXISTS typically_offered TEXT NOT NULL DEFAULT '', + ADD COLUMN IF NOT EXISTS contact_hours FLOAT UNSIGNED NOT NULL DEFAULT 0;