Skip to content

Commit dcf6910

Browse files
committed
Changing contact hours to float.
1 parent d372752 commit dcf6910

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

schema/migrationScripts/f_4charcourses.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CREATE PROCEDURE InsertOrUpdateCourse(
2222
IN p_description TEXT,
2323
IN p_prerequisites TEXT,
2424
IN p_typically_offered TEXT,
25-
IN p_contact_hours TEXT
25+
IN p_contact_hours FLOAT
2626
)
2727
BEGIN
2828
-- Determine if the course already exists

schema/procedures/InsertOrUpdateCourse.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CREATE PROCEDURE InsertOrUpdateCourse(
1010
IN p_description TEXT,
1111
IN p_prerequisites TEXT,
1212
IN p_typically_offered TEXT,
13-
IN p_contact_hours TEXT
13+
IN p_contact_hours FLOAT
1414
)
1515
BEGIN
1616
-- Determine if the course already exists

schema/tables/courses.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CREATE TABLE courses (
1818
`description` TEXT NOT NULL,
1919
`prerequisites` TEXT NOT NULL,
2020
`typically_offered` TEXT NOT NULL,
21-
`contact_hours` TEXT NOT NULL
21+
`contact_hours` FLOAT UNSIGNED NOT NULL
2222
)ENGINE=InnoDb;
2323

2424
-- INDEXING ----------------------------------------------------------------

tools/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ function halt($messages) {
9595
* @param $description string The description for the course
9696
* @param $prerequisites string The prerequisites for the course
9797
* @param $typicallyOffered string The typically offered semester for the course
98-
* @param $contactHours string The contact hours for the course
98+
* @param $contactHours float The contact hours for the course
9999
* @return mixed String of error message returned on failure.
100100
* Integer of course ID returned on success
101101
*/
102-
function insertOrUpdateCourse(int $quarter, string $departCode, string $classCode, string $course, int $credits, string $title, string $description, string $prerequisites, string $typicallyOffered, string $contactHours) {
102+
function insertOrUpdateCourse(int $quarter, string $departCode, string $classCode, string $course, int $credits, string $title, string $description, string $prerequisites, string $typicallyOffered, float $contactHours) {
103103
global $coursesUpdated, $coursesAdded;
104104
// Call the stored proc
105105
// TODO: Refactor out department ID number (0000)

tools/processDump.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
`course_descrlong` text NOT NULL,
105105
`prereqs` text NOT NULL,
106106
`typ_offr` text NOT NULL,
107-
`ctc_hrs` text NOT NULL,
107+
`ctc_hrs` float NOT NULL,
108108
PRIMARY KEY (`crse_id`,`crse_offer_nbr`,`strm`,`session_code`,`class_section`)
109109
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
110110
ENE;
@@ -302,11 +302,10 @@
302302
$row['course_descrlong'] = mysqli_real_escape_string($dbConn, $row['course_descrlong']);
303303
$row['prereqs'] = mysqli_real_escape_string($dbConn, $row['prereqs']);
304304
$row['typ_offr'] = mysqli_real_escape_string($dbConn, $row['typ_offr']);
305-
$row['ctc_hrs'] = mysqli_real_escape_string($dbConn, $row['ctc_hrs']);
306305

307306
// Insert or update the course
308307
@$courseId = $parser->insertOrUpdateCourse($row['qtr'], $row['acad_org'], $row['subject'], $row['catalog_nbr'],
309-
(int)$row['units'], $row['descr'], $row['course_descrlong'], $row['prereqs'], $row['typ_offr'], $row['ctc_hrs']);
308+
(int)$row['units'], $row['descr'], $row['course_descrlong'], $row['prereqs'], $row['typ_offr'], (float)$row['ctc_hrs']);
310309
if (!is_numeric($courseId)) {
311310
echo(" *** Error: Failed to update {$row['qtr']} {$row['subject']}-{$row['catalog_nbr']}\n");
312311
echo(" ");

0 commit comments

Comments
 (0)