2929/** primary process class */
3030class submitty_student_auto_feed {
3131 /** File handle to read CSV */
32- private resource $ fh ;
32+ private $ fh ;
3333 /** Semester code */
3434 private string $ semester ;
3535 /** List of courses registered in Submitty */
@@ -83,9 +83,6 @@ public function __construct() {
8383 exit (1 );
8484 }
8585
86- // Helper object for special-cases involving RCOS.
87- $ this ->rcos = new rcos ();
88-
8986 // Get course list
9087 $ error = null ;
9188 $ this ->course_list = db::get_course_list ($ this ->semester , $ error );
@@ -103,12 +100,12 @@ public function __construct() {
103100 exit (1 );
104101 }
105102
106- // RCOS courses should not be mapped in the database.
107-
108-
109103 // Get CRN shared courses/sections (when a course/section is copied to another course/section)
110104 $ this ->crn_copymap = $ this ->read_crn_copymap ();
111105
106+ // Helper object for special-cases involving RCOS.
107+ $ this ->rcos = new rcos ();
108+
112109 // Init other properties.
113110 $ this ->invalid_courses = [];
114111 $ this ->data = [];
@@ -203,9 +200,6 @@ private function get_csv_data() {
203200 // Course is comprised of an alphabetic prefix and a numeric suffix.
204201 $ course = strtolower ($ row [COLUMN_COURSE_PREFIX ] . $ row [COLUMN_COURSE_NUMBER ]);
205202
206- // Check/perform special-case RCOS registration section mapping.
207- rcos::map ($ course , $ row );
208-
209203 switch (true ) {
210204 // Check that $row has an appropriate student registration.
211205 case array_search ($ row [COLUMN_REGISTRATION ], $ all_valid_reg_codes ) === false :
@@ -224,6 +218,9 @@ private function get_csv_data() {
224218 // Check that $row is associated with the course list.
225219 case array_search ($ course , $ this ->course_list ) !== false :
226220 if (validate::validate_row ($ row , $ row_num )) {
221+ // Check (and perform) special-case RCOS registration section mapping.
222+ $ this ->rcos ->map ($ course , $ row );
223+
227224 // Include $row
228225 $ this ->data [$ course ][] = $ row ;
229226
@@ -245,8 +242,13 @@ private function get_csv_data() {
245242 if (array_key_exists ($ section , $ this ->mapped_courses [$ course ])) {
246243 $ m_course = $ this ->mapped_courses [$ course ][$ section ]['mapped_course ' ];
247244 if (validate::validate_row ($ row , $ row_num )) {
248- // Include $row .
245+ // Do course mapping (alters registration section) .
249246 $ row [COLUMN_SECTION ] = $ this ->mapped_courses [$ course ][$ section ]['mapped_section ' ];
247+
248+ // Check (and override) for special-case RCOS registration section mapping.
249+ $ this ->rcos ->map ($ course , $ row );
250+
251+ // Include $row.
250252 $ this ->data [$ m_course ][] = $ row ;
251253
252254 // $row with a blank email is allowed, but it is also logged.
0 commit comments