You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: sample_bin/registration_section_resync.php
+3-3
Original file line number
Diff line number
Diff line change
@@ -84,7 +84,7 @@ private function process() {
84
84
//Loop through academic terms
85
85
foreach (self::$academic_termsas$term) {
86
86
//Get courses list for $term
87
-
$res = pg_query_params(self::$db_conn['master'], "SELECT course FROM courses WHERE semester = $1", array($term));
87
+
$res = pg_query_params(self::$db_conn['master'], "SELECT course FROM courses WHERE term = $1", array($term));
88
88
if ($res === false) {
89
89
exit(sprintf("Error reading course list for %s.%s", $term, PHP_EOL));
90
90
}
@@ -107,7 +107,7 @@ private function process() {
107
107
}
108
108
109
109
//First retrieve registration sections in master DB
110
-
$res = pg_query_params(self::$db_conn['master'], "SELECT registration_section_id FROM courses_registration_sections WHERE semester=$1 AND course=$2", array($term, $course));
110
+
$res = pg_query_params(self::$db_conn['master'], "SELECT registration_section_id FROM courses_registration_sections WHERE term=$1 AND course=$2", array($term, $course));
//INSERT $sync_list to master DB, ON CONFLICT DO NOTHING (prevents potential PK violations). We're using DB schema trigger to complete resync.
137
137
foreach($sync_listas$section) {
138
-
$res = pg_query_params(self::$db_conn['master'], "INSERT INTO courses_registration_sections (semester, course, registration_section_id) VALUES ($1, $2, $3) ON CONFLICT ON CONSTRAINT courses_registration_sections_pkey DO UPDATE SET semester=$1, course=$2, registration_section_id=$3", array($term, $course, $section));
138
+
$res = pg_query_params(self::$db_conn['master'], "INSERT INTO courses_registration_sections (term, course, registration_section_id) VALUES ($1, $2, $3) ON CONFLICT ON CONSTRAINT courses_registration_sections_pkey DO UPDATE SET term=$1, course=$2, registration_section_id=$3", array($term, $course, $section));
139
139
if ($res === false) {
140
140
fprintf(STDERR, "Error during re-sync procedure: %s %s section %s.%s.This section could not be synced.%s", $term, $course, $section, PHP_EOL, PHP_EOL);
$sql = "SELECT COUNT(*) FROM courses_users WHERE semester=$1 AND course=$2 AND user_group=4 AND registration_section IS NOT NULL AND manual_registration=TRUE";
217
+
$sql = "SELECT COUNT(*) FROM courses_users WHERE term=$1 AND course=$2 AND user_group=4 AND registration_section IS NOT NULL AND manual_registration=TRUE";
218
218
$res = pg_query_params(self::$db, $sql, $params);
219
219
if ($res === false)
220
220
die("Failed to lookup counts with manual flag set for {$course}\n");
$sql = "SELECT COUNT(*) FROM courses_users WHERE semester=$1 AND course=$2 AND user_group=4 AND registration_section='1' AND manual_registration=TRUE";
232
+
$sql = "SELECT COUNT(*) FROM courses_users WHERE term=$1 AND course=$2 AND user_group=4 AND registration_section='1' AND manual_registration=TRUE";
233
233
$res = pg_query_params(self::$db, $sql, $params);
234
234
if ($res === false)
235
235
die("Failed to lookup counts with manual flag set for {$course} (undergrads)\n");
$sql = "SELECT COUNT(*) FROM courses_users WHERE semester=$1 AND course=$2 AND user_group=4 AND registration_section='2' AND manual_registration=TRUE";
246
+
$sql = "SELECT COUNT(*) FROM courses_users WHERE term=$1 AND course=$2 AND user_group=4 AND registration_section='2' AND manual_registration=TRUE";
247
247
$res = pg_query_params(self::$db, $sql, $params);
248
248
if ($res === false)
249
249
die("Failed to lookup counts with manual flag set for {$course} (grads)\n");
0 commit comments