Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
371d9e6
Added banner stating that schedule maker isn't working
tmcnulty387 Nov 4, 2024
98cbcf5
Merge pull request #356 from tmcnulty387/develop
Mobmaker55 Nov 5, 2024
f5b291f
Revert "Added banner stating that schedule maker isn't working"
tmcnulty387 Nov 10, 2024
52f58d9
Merge pull request #359 from tmcnulty387/develop
Mstrodl Nov 15, 2024
2485bc3
Merge pull request #366 from ComputerScienceHouse/fix-ntid-classes
BigSpaceships Apr 3, 2026
f32d05d
I updated the dump process to handle 3 new course fields: Prerequisit…
NathanRusso Sep 4, 2026
89e152d
I added the new column to the CREATE TABLE statement.
NathanRusso Sep 4, 2026
f87acfc
Updated the insertOrUpdateCourse code.
NathanRusso Sep 4, 2026
d372752
Fixed syntax errors.
NathanRusso Sep 4, 2026
dcf6910
Changing contact hours to float.
NathanRusso Sep 9, 2026
511cc3f
I added a new script, but idk if I should have NOT NULL or not.
NathanRusso Sep 9, 2026
ebc680a
I added defaults.
NathanRusso Sep 9, 2026
5dfc98d
I missed this file...
NathanRusso Sep 9, 2026
e9f6c73
I was able to get ScheduleMaker to build.
NathanRusso Sep 9, 2026
92f701e
Updated scripts and php.
NathanRusso Sep 12, 2026
0dabe67
I fixed a bug with parsing.
NathanRusso Sep 12, 2026
f249140
Tested and added a bit more to my migration script.
NathanRusso Sep 12, 2026
427288b
Undo changes on existing migrations.
NathanRusso Sep 14, 2026
9d1f7cb
Added back a space.
NathanRusso Sep 14, 2026
5bba2cd
I added a new migration script.
NathanRusso Oct 6, 2026
79d3957
Removed space.
NathanRusso Oct 6, 2026
dbd5c04
I added a script to update the buildings.
NathanRusso Oct 14, 2026
6c10656
Fixed typo.
NathanRusso Oct 15, 2026
94b4d49
I found another missing value.
NathanRusso Oct 15, 2026
d161c23
Added more missing buildings.
NathanRusso Oct 21, 2026
ef0b12c
Updated PAC.
NathanRusso Oct 22, 2026
a41b1c8
Merge branch 'develop' into course-extension
NathanRusso Oct 22, 2026
33d754b
Updated a tiny syntax error from the recent migration.
NathanRusso Oct 22, 2026
8f9f04e
Updated multi query error handling for php 8.4.
NathanRusso Oct 22, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ web.config
vwd.webinfo
WebEssentials-Settings.json
vendor
.vscode
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <matted@csh.rit.edu>"

WORKDIR /usr/src/schedule
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
7 changes: 5 additions & 2 deletions api/entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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']
];
}

Expand Down
15 changes: 15 additions & 0 deletions schema/migrationScripts/building-extension.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- -------------------------------------------------------------------------
-- Migration Script for building-extension
--
-- @author Nathan Russo (nathanr@csh.rit.edu)
-- @descrip Migration script to add missing buildings to the buildings table.
-- -------------------------------------------------------------------------

INSERT INTO buildings (number, code, name, off_campus) VALUES
('83', 'PAC', 'Performing Arts Center', 0),
('820', '820', '820', 0),
('909', '909', 'Annex IX', 0),
('G', 'G', 'G DUBAI', 1),
('H', 'H', 'H DUBAI', 1),
('TIRM', 'TIRM', 'TIRANA', 1),
('TIRT', 'TIRT', 'TIRT', 1);
11 changes: 11 additions & 0 deletions schema/migrationScripts/course-extension.sql
Original file line number Diff line number Diff line change
@@ -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 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;
10 changes: 10 additions & 0 deletions schema/migrationScripts/section-type-extension.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- -------------------------------------------------------------------------
-- Migration Script for section-type-extension
--
-- @author Nathan Russo (nathanr@csh.rit.edu)
-- @descrip Migration script to add 'OA' and 'OS' to the possible enum values for a section's type.
-- -------------------------------------------------------------------------

ALTER TABLE sections MODIFY COLUMN type
ENUM('R', 'N', 'H', 'BL', 'OL', 'OS', 'OA') DEFAULT 'R' NOT NULL
COMMENT 'R=Regular, N=Night, H=Honors, BL=Blended Learning, OL=Online, OS=Online - Synchronous, OA=Online - Asynchronous';
15 changes: 9 additions & 6 deletions schema/procedures/InsertOrUpdateCourse.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 FLOAT
)
BEGIN
-- Determine if the course already exists
Expand Down Expand Up @@ -40,14 +43,14 @@ 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;
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);
SELECT "inserted" AS action;
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;

-- Return the id of the course
Expand Down
4 changes: 2 additions & 2 deletions schema/procedures/InsertOrUpdateSection.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion schema/tables/courses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 DEFAULT '',
`typically_offered` TEXT NOT NULL DEFAULT '',
`contact_hours` FLOAT UNSIGNED NOT NULL DEFAULT 0
)ENGINE=InnoDb;

-- INDEXING ----------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions schema/tables/schools.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------------------------------------------
Expand Down
51 changes: 33 additions & 18 deletions tools/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,31 +86,43 @@ 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 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) {
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)
$query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}')";
$success = mysqli_multi_query($this->dbConn, $query);
$query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$classCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', {$contactHours})";

// Catch errors or return the id
// Error check
try {
mysqli_multi_query($this->dbConn, $query);
$success = true;
} catch (\mysqli_sql_exception $e) {
$success = false;
}

// Error check
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}')";
$success = mysqli_multi_query($this->dbConn, $query);
if (!$success) {
return mysqli_error($this->dbConn);
$query = "CALL InsertOrUpdateCourse({$quarter}, 0000, '{$departCode}', '{$course}', {$credits}, '{$title}', '{$description}', '{$prerequisites}', '{$typicallyOffered}', {$contactHours})";
try {
mysqli_multi_query($this->dbConn, $query);
} catch (\mysqli_sql_exception $e) {
return $e->getMessage();
//return mysqli_error($this->dbConn);
}
}

Expand Down Expand Up @@ -144,8 +156,11 @@ function insertOrUpdateSection($courseId, $section, $title, $instructor, $type,
$query .= "{$maxenroll},{$curenroll})";

// Error check
if (!mysqli_multi_query($this->dbConn, $query)) {
return mysqli_error($this->dbConn);
try {
mysqli_multi_query($this->dbConn, $query);
} catch (\mysqli_sql_exception $e) {
return $e->getMessage();
//return mysqli_error($this->dbConn);
}

// First result is the action performed
Expand Down Expand Up @@ -191,7 +206,7 @@ function getTempSections($courseNum, $offerNum, $term, $sessionNum) {
return $list;
}

function fileToTempTable(string $tableName, $file, $fields, $fileSize, string $procFunc = null) {
function fileToTempTable(string $tableName, $file, $fields, $fileSize, ?string $procFunc = null) {
// Process the file
$procBytes = 0;
$outPercent = [0];
Expand Down
11 changes: 8 additions & 3 deletions tools/processDump.php
Original file line number Diff line number Diff line change
Expand Up @@ -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` float NOT NULL,
PRIMARY KEY (`crse_id`,`crse_offer_nbr`,`strm`,`session_code`,`class_section`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ENE;
Expand All @@ -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
Expand Down Expand Up @@ -268,7 +271,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,";
$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);
Expand Down Expand Up @@ -298,10 +301,12 @@
// 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']);

// 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'], (float)$row['ctc_hrs']);
if (!is_numeric($courseId)) {
echo(" *** Error: Failed to update {$row['qtr']} {$row['subject']}-{$row['catalog_nbr']}\n");
echo(" ");
Expand Down
Loading