29
29
/** primary process class */
30
30
class submitty_student_auto_feed {
31
31
/** File handle to read CSV */
32
- private resource $ fh ;
32
+ private $ fh ;
33
33
/** Semester code */
34
34
private string $ semester ;
35
35
/** List of courses registered in Submitty */
@@ -83,9 +83,6 @@ public function __construct() {
83
83
exit (1 );
84
84
}
85
85
86
- // Helper object for special-cases involving RCOS.
87
- $ this ->rcos = new rcos ();
88
-
89
86
// Get course list
90
87
$ error = null ;
91
88
$ this ->course_list = db::get_course_list ($ this ->semester , $ error );
@@ -103,12 +100,12 @@ public function __construct() {
103
100
exit (1 );
104
101
}
105
102
106
- // RCOS courses should not be mapped in the database.
107
-
108
-
109
103
// Get CRN shared courses/sections (when a course/section is copied to another course/section)
110
104
$ this ->crn_copymap = $ this ->read_crn_copymap ();
111
105
106
+ // Helper object for special-cases involving RCOS.
107
+ $ this ->rcos = new rcos ();
108
+
112
109
// Init other properties.
113
110
$ this ->invalid_courses = [];
114
111
$ this ->data = [];
@@ -203,9 +200,6 @@ private function get_csv_data() {
203
200
// Course is comprised of an alphabetic prefix and a numeric suffix.
204
201
$ course = strtolower ($ row [COLUMN_COURSE_PREFIX ] . $ row [COLUMN_COURSE_NUMBER ]);
205
202
206
- // Check/perform special-case RCOS registration section mapping.
207
- rcos::map ($ course , $ row );
208
-
209
203
switch (true ) {
210
204
// Check that $row has an appropriate student registration.
211
205
case array_search ($ row [COLUMN_REGISTRATION ], $ all_valid_reg_codes ) === false :
@@ -224,6 +218,9 @@ private function get_csv_data() {
224
218
// Check that $row is associated with the course list.
225
219
case array_search ($ course , $ this ->course_list ) !== false :
226
220
if (validate::validate_row ($ row , $ row_num )) {
221
+ // Check (and perform) special-case RCOS registration section mapping.
222
+ $ this ->rcos ->map ($ course , $ row );
223
+
227
224
// Include $row
228
225
$ this ->data [$ course ][] = $ row ;
229
226
@@ -245,8 +242,13 @@ private function get_csv_data() {
245
242
if (array_key_exists ($ section , $ this ->mapped_courses [$ course ])) {
246
243
$ m_course = $ this ->mapped_courses [$ course ][$ section ]['mapped_course ' ];
247
244
if (validate::validate_row ($ row , $ row_num )) {
248
- // Include $row .
245
+ // Do course mapping (alters registration section) .
249
246
$ 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.
250
252
$ this ->data [$ m_course ][] = $ row ;
251
253
252
254
// $row with a blank email is allowed, but it is also logged.
0 commit comments