diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..86a5888 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# pycache +app/__pycache__/ +app/util/__pycache__/ + +# output +output/ \ No newline at end of file diff --git a/app/__pycache__/generator.cpython-311.pyc b/app/__pycache__/generator.cpython-311.pyc deleted file mode 100644 index 0369522..0000000 Binary files a/app/__pycache__/generator.cpython-311.pyc and /dev/null differ diff --git a/app/util/__pycache__/estimateGrade.cpython-311.pyc b/app/util/__pycache__/estimateGrade.cpython-311.pyc deleted file mode 100644 index 2eecaf0..0000000 Binary files a/app/util/__pycache__/estimateGrade.cpython-311.pyc and /dev/null differ diff --git a/app/util/__pycache__/getCourses.cpython-311.pyc b/app/util/__pycache__/getCourses.cpython-311.pyc deleted file mode 100644 index 5f043e9..0000000 Binary files a/app/util/__pycache__/getCourses.cpython-311.pyc and /dev/null differ diff --git a/app/util/__pycache__/getStudents.cpython-311.pyc b/app/util/__pycache__/getStudents.cpython-311.pyc deleted file mode 100644 index 19d7af6..0000000 Binary files a/app/util/__pycache__/getStudents.cpython-311.pyc and /dev/null differ diff --git a/app/util/__pycache__/globals.cpython-311.pyc b/app/util/__pycache__/globals.cpython-311.pyc deleted file mode 100644 index 4f6fb6b..0000000 Binary files a/app/util/__pycache__/globals.cpython-311.pyc and /dev/null differ diff --git a/app/util/getCourses.py b/app/util/getCourses.py index 2f18f78..01fde22 100644 --- a/app/util/getCourses.py +++ b/app/util/getCourses.py @@ -22,8 +22,7 @@ def getCourses( courses[row["CrsNo"]] = { "CrsNo": row["CrsNo"], "Requests": 0, - "Description": row["Description"], - "students": [] + "Description": row["Description"] } if log: diff --git a/main.py b/main.py index 9bad127..8d3e915 100755 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3.11 import eel +import os from app.generator import generateScheduleV3 from app.util.globals import Error from app.util.getCourses import getCourses @@ -9,15 +10,28 @@ eel.init('template') @eel.expose def start( - input_file_dir: str, + raw_file_data: str, min_req: int, class_cap: int, block_class_limit: int, total_blocks: int, ) -> Error: + # Ensure output paths exists + if not os.path.exists('output'): os.makedirs('output') + if not os.path.exists('output/temp'): os.makedirs('output/temp') + if not os.path.exists('output/final'): os.makedirs('output/final') + if not os.path.exists('output/final/student_schedules'): os.makedirs('output/final/student_schedules') + if not os.path.exists('output/raw'): os.makedirs('output/raw') + + raw_data_dir = './output/temp/course_selection_data.csv' + + # save raw file data to local file + with open(raw_data_dir, 'w') as raw_file: + raw_file_data = raw_file_data.replace('\n', '') + raw_file.write(raw_file_data) + # Ensure params are of correct type - input_file_dir = str(input_file_dir) min_req = int(min_req) class_cap = int(class_cap) block_class_limit = int(block_class_limit) @@ -26,11 +40,20 @@ def start( err = None # call pre-algorithm functions read raw data into a processable format - students = getStudents(input_file_dir, log=True, totalBlocks=total_blocks) - courses = getCourses(input_file_dir, log=True) + students = getStudents( + raw_data_dir, + log=True, + totalBlocks=total_blocks, + log_dir='./output/raw/students.json' + ) + courses = getCourses( + raw_data_dir, + log=True, + log_dir='./output/raw/courses.json' + ) # call algorithm to sort data - master_timetable, err = generateScheduleV3( + _, err = generateScheduleV3( students, courses, minReq=min_req, @@ -41,6 +64,8 @@ def start( conflictsDir='./output/raw/conflicts.json' ) + print(err) + # TODO: log master_timetable # TODO: call post-algorithm functions to present sorted data diff --git a/template/index.html b/template/index.html index 2990933..c2e590a 100644 --- a/template/index.html +++ b/template/index.html @@ -17,7 +17,7 @@
-