From 2f4d59b10d99b6f1460fb4bc7871f71c1969c7b6 Mon Sep 17 00:00:00 2001 From: pbailie Date: Wed, 1 Feb 2023 14:20:50 -0500 Subject: [PATCH 1/2] New ID column for course and section --- student_auto_feed/config.php | 1 + student_auto_feed/ssaf_db.php | 2 +- student_auto_feed/ssaf_sql.php | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) 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 298e512..633f392 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_id +) VALUES ($1, $2, $3, $4) ON CONFLICT DO NOTHING SQL; From c38346ddac59820a4405b1f0d0cd6b5c1260249a Mon Sep 17 00:00:00 2001 From: pbailie Date: Thu, 23 Feb 2023 15:09:13 -0500 Subject: [PATCH 2/2] Update ssaf_sql.php --- student_auto_feed/ssaf_sql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/student_auto_feed/ssaf_sql.php b/student_auto_feed/ssaf_sql.php index 633f392..1fcb9b8 100644 --- a/student_auto_feed/ssaf_sql.php +++ b/student_auto_feed/ssaf_sql.php @@ -101,7 +101,7 @@ class sql { semester, course, registration_section_id, - course_id + course_section_id ) VALUES ($1, $2, $3, $4) ON CONFLICT DO NOTHING SQL;