diff --git a/student_auto_feed/config.php b/student_auto_feed/config.php index c6d4164..9092883 100644 --- a/student_auto_feed/config.php +++ b/student_auto_feed/config.php @@ -116,6 +116,7 @@ define('COLUMN_PREFERREDNAME', 3); //Student's Preferred Name define('COLUMN_EMAIL', 4); //Student's Campus Email define('COLUMN_TERM_CODE', 11); //Semester code used in data validation +define('COLUMN_REG_ID', 12); //Course and Section registration ID //Validate term code. Set to null to disable this check. define('EXPECTED_TERM_CODE', '201705'); diff --git a/student_auto_feed/ssaf_db.php b/student_auto_feed/ssaf_db.php index 19fec1a..43276d9 100644 --- a/student_auto_feed/ssaf_db.php +++ b/student_auto_feed/ssaf_db.php @@ -199,7 +199,7 @@ public static function upsert($semester, $course, $rows) : bool { "FALSE" ); - $reg_sections_params = array($semester, $course, $row[COLUMN_SECTION]); + $reg_sections_params = array($semester, $course, $row[COLUMN_SECTION], $row[COLUMN_REG_ID]); $tmp_table_params = array($row[COLUMN_USER_ID]); $dropped_users_params = array($semester, $course); diff --git a/student_auto_feed/ssaf_sql.php b/student_auto_feed/ssaf_sql.php index 978048e..2f03218 100644 --- a/student_auto_feed/ssaf_sql.php +++ b/student_auto_feed/ssaf_sql.php @@ -100,8 +100,9 @@ class sql { INSERT INTO courses_registration_sections ( semester, course, - registration_section_id -) VALUES ($1, $2, $3) + registration_section_id, + course_section_id +) VALUES ($1, $2, $3, $4) ON CONFLICT DO NOTHING SQL;