optionally save student schedules to docx
This commit is contained in:
4 files changed
+25
-4
No files matched your search
@@ -17,7 +17,8 @@ def start(
|
||||
class_cap: int,
|
||||
block_class_limit: int,
|
||||
total_blocks: int,
|
||||
) -> dict:
|
||||
save_student_schedules: bool
|
||||
) -> Error.__dict__: # Return Error dataclass as dict
|
||||
|
||||
raw_data_dir = './output/temp/course_selection_data.csv'
|
||||
raw_json_dir = './output/raw/json'
|
||||
@@ -28,11 +29,13 @@ def start(
|
||||
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')
|
||||
if not os.path.exists('output/raw/json'): os.makedirs('output/raw/json')
|
||||
if not os.path.exists('output/raw/csv'): os.makedirs('output/raw/csv')
|
||||
|
||||
# Only ensure folder exists if we want to save student schedules to docx files
|
||||
if save_student_schedules and not os.path.exists('output/final/student_schedules'): os.makedirs('output/final/student_schedules')
|
||||
|
||||
# save raw file data to local file
|
||||
eel.post_data('Saving raw data to local file...')
|
||||
with open(raw_data_dir, 'w') as raw_file:
|
||||
@@ -90,6 +93,7 @@ def start(
|
||||
writeCoursesToCSV(courses, output_dir='./output/raw/csv/courses.csv')
|
||||
|
||||
eel.post_data('Writing timetables to .docx files...')
|
||||
if save_student_schedules:
|
||||
for student in students:
|
||||
putScheduleToWord(courses, student, './output/final/student_schedules')
|
||||
|
||||
|
||||
@@ -30,6 +30,15 @@
|
||||
accept=".csv"
|
||||
>
|
||||
|
||||
<label style="display: inline-block" for="save_student_schedules">Save Student Schedules to .docx</label>
|
||||
<input
|
||||
style="margin-left: 5px;transform:scale(1.5)"
|
||||
type="checkbox"
|
||||
id="save_student_schedules"
|
||||
name="save_student_schedules"
|
||||
value="save_student_schedules"
|
||||
>
|
||||
|
||||
<label for="classrooms">Number of classrooms (20-100)</label>
|
||||
<input
|
||||
required
|
||||
|
||||
+9
-1
@@ -6,6 +6,7 @@ function start() {
|
||||
let classCap = document.getElementById("class_cap").value;
|
||||
let blockClassLimit = document.getElementById("classrooms").value;
|
||||
let totalBlocks = document.getElementById("total_blocks").value;
|
||||
let saveStudentSchedules = document.getElementById("save_student_schedules").checked;
|
||||
|
||||
// ensure data is passed before continuing
|
||||
if (!e(file) || !e(minReq) || !e(classCap) || !e(blockClassLimit) || !e(totalBlocks)) return alert('Please ensure all fields aren\'t empty.');
|
||||
@@ -17,7 +18,14 @@ function start() {
|
||||
let reader = new FileReader()
|
||||
reader.addEventListener("load", () => {
|
||||
let raw = reader.result;
|
||||
eel.start(raw, minReq, classCap, blockClassLimit, totalBlocks)(finish_callback);
|
||||
eel.start(
|
||||
raw,
|
||||
minReq,
|
||||
classCap,
|
||||
blockClassLimit,
|
||||
totalBlocks,
|
||||
saveStudentSchedules
|
||||
)(finish_callback);
|
||||
}, false);
|
||||
|
||||
if (file) {
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ body{
|
||||
bottom: -80px;
|
||||
}
|
||||
.main{
|
||||
height: 600px;
|
||||
height: 640px;
|
||||
width: 400px;
|
||||
background-color: rgba(255,255,255,0.13);
|
||||
position: absolute;
|
||||
|
||||
Reference in new issue
Block a user