step 2 works

This commit is contained in:
SowinskiBraeden committed 2024-10-04 16:32:10 -07:00
1 parent 6149fb287f
commit b982588fb2
1 file changed
+2 -5
+2 -5
View File
@@ -561,7 +561,7 @@ TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *cou
// Create new class with remaining // Create new class with remaining
CLASS newClass; CLASS newClass;
char courseID[MAX_COURSE_NO_LEN + 3]; // +3 = "_n\0" where n is the ID char courseID[MAX_COURSE_NO_LEN + 3]; // +3 = "_n\0" where n is the ID
strcpy(courseID, course[index].crsNo); strcpy(courseID, courses[index].crsNo);
appendChar(courseID, hex[classRunCount]); appendChar(courseID, hex[classRunCount]);
strcpy(newClass.crsNo, courseID); strcpy(newClass.crsNo, courseID);
strcpy(newClass.description, courses[index].description); strcpy(newClass.description, courses[index].description);
@@ -594,10 +594,7 @@ TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *cou
bool full = false; bool full = false;
while (!full) { while (!full) {
if (remaining == 0) break; // should not be possible but not taking chances for (size_t j = 0; j < classRunCount; j++) {
for (size_t j = 0; j < classRunCounnt; j++) {
if (remaining == 0) break; // same here
if (emptyClasses[courseClassIndexes[j]].numberOfStudents == CLASS_CAP) continue; // this shouldn't be possible either, but still not taking chances
if (emptyClasses[courseClassIndexes[classRunCount - 1]].numberOfStudents == CLASS_CAP) { if (emptyClasses[courseClassIndexes[classRunCount - 1]].numberOfStudents == CLASS_CAP) {
// If the last class in the array is at class_cap, all other classes must be at class cap and we are full // If the last class in the array is at class_cap, all other classes must be at class cap and we are full
full = true; full = true;