Skip to content

Commit 487f849

Browse files
authored
Merge pull request #136 from devinmatte/develop
Fix Major Parse Errors
2 parents 168e0f9 + 205e7bd commit 487f849

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tools/processDump.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ function fileToTempTable($tableName, $file, $fields, $fileSize, $procFunc=NULL)
300300
`strm` int(4) UNSIGNED NOT NULL,
301301
`session_code` varchar(4) NOT NULL,
302302
`class_section` varchar(4) NOT NULL,
303-
`subject` int(4) UNSIGNED ZEROFILL NOT NULL,
303+
`subject` VARCHAR (4) NOT NULL,
304304
`catalog_nbr` VARCHAR(4) NOT NULL,
305305
`descr` text NOT NULL,
306306
`topic` text NOT NULL,
@@ -457,9 +457,13 @@ function procInstrArray($lineSplit) {
457457
preg_match("/(\d)(\d{3})/", $row['strm'], $match);
458458
$row['strm'] = $match[1] . 0 . $match[2];
459459

460+
// Create a default break value
461+
$break = '0000-00-00';
462+
460463
// Insert the quarter
461-
$query = "INSERT INTO quarters (quarter, start, end)";
462-
$query .= " VALUES({$row['strm']}, '{$row['start_dt']}', '{$row['end_dt']}')";
464+
// TODO: Change schema from quarters to semesters (I doubt they're switching back anytime soon)
465+
$query = "INSERT INTO quarters (quarter, start, end, breakstart, breakend)";
466+
$query .= " VALUES({$row['strm']}, '{$row['start_dt']}', '{$row['end_dt']}', $break, $break)";
463467
$query .= " ON DUPLICATE KEY UPDATE";
464468
$query .= " start='{$row['start_dt']}', end='{$row['end_dt']}'";
465469

@@ -557,8 +561,8 @@ function procInstrArray($lineSplit) {
557561
$row['course_descrlong'] = mysqli_real_escape_string($dbConn, $row['course_descrlong']);
558562

559563
// Insert or update the course
560-
$courseId = insertOrUpdateCourse($row['qtr'], $row['subject'], $row['acad_org'], $row['catalog_nbr'],
561-
$row['units'], $row['descr'], $row['course_descrlong']);
564+
$courseId = insertOrUpdateCourse($row['qtr'], 0000, $row['acad_org'], $row['catalog_nbr'],
565+
$row['units'], $row['descr'], $row['course_descrlong']);
562566
if(!is_numeric($courseId)) {
563567
echo(" *** Error: Failed to update {$row['qtr']} {$row['subject']}{$row['acad_org']}-{$row['catalog_nbr']}\n");
564568
echo(" ");
@@ -702,6 +706,7 @@ function procInstrArray($lineSplit) {
702706
$days = array($time['sun'], $time['mon'], $time['tues'], $time['wed'], $time['thurs'], $time['fri'], $time['sat']);
703707
foreach($days as $i => $dayTruth) {
704708
if($dayTruth == 'Y') {
709+
// TODO: Fix schema to allow `room` to be larger than varchar(4)
705710
$timeInsert = "INSERT INTO times (section, day, start, end, building, room)";
706711
$timeInsert .= " VALUES({$sectId}, {$i}, {$startTime}, {$endTime}, ";
707712
$timeInsert .= "'{$time['bldg']}', '{$time['room_nbr']}')";

0 commit comments

Comments
 (0)