calculate students expectedClasses
This commit is contained in:
5 files changed
+10
-9
No files matched your search
@@ -24,6 +24,4 @@ typedef enum {
|
|||||||
|
|
||||||
TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *courses, size_t size_courses);
|
TIMETABLE generateTimetable(STUDENT *students, size_t size_students, COURSE *courses, size_t size_courses);
|
||||||
|
|
||||||
bool isFlex(char crsNo[MAX_COURSE_NO_LEN]);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -35,4 +35,6 @@ static const char FLEX[][11] = {"XAT--12A-S", "XAT--12B-S"};
|
|||||||
|
|
||||||
void handle(void* mem, char name[]);
|
void handle(void* mem, char name[]);
|
||||||
|
|
||||||
|
bool isFlex(char crsNo[MAX_COURSE_NO_LEN]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -10,13 +10,6 @@
|
|||||||
|
|
||||||
const char hex[] = "0123456789abcdefABCDEF";
|
const char hex[] = "0123456789abcdefABCDEF";
|
||||||
|
|
||||||
// May be needed later
|
|
||||||
bool isFlex(char crsNo[MAX_COURSE_NO_LEN]) {
|
|
||||||
for (uint8_t i = 0; i < sizeof(FLEX)/sizeof(FLEX[0]); i++)
|
|
||||||
if (strcmp(crsNo, FLEX[i]) == 0) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void appendChar(char *str, char ch) {
|
void appendChar(char *str, char ch) {
|
||||||
int len = strlen(str);
|
int len = strlen(str);
|
||||||
str[len] = ch;
|
str[len] = ch;
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ void handle(void *mem, char name[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isFlex(char crsNo[MAX_COURSE_NO_LEN]) {
|
||||||
|
for (uint8_t i = 0; i < sizeof(FLEX)/sizeof(FLEX[0]); i++)
|
||||||
|
if (strcmp(crsNo, FLEX[i]) == 0) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
/*
|
/*
|
||||||
read csv data into array of structs that can
|
read csv data into array of structs that can
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ STUDENT *getStudents(CSV_LINE *lines, size_t lines_len, int total_blocks, UNIQUE
|
|||||||
request.alternate = lines[i].alternate;
|
request.alternate = lines[i].alternate;
|
||||||
students[j].requests[students[j].requestsLen] = request;
|
students[j].requests[students[j].requestsLen] = request;
|
||||||
students[j].requestsLen++;
|
students[j].requestsLen++;
|
||||||
|
if (!isFlex(request.crsNo) && !request.alternate && students[j].expectedClasses < TOTAL_BLOCKS)
|
||||||
|
students[j].expectedClasses++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user