Commit ec9ee9a2 authored by Deb's avatar Deb
Browse files

dynamic outfolder

parent 32ebdd62
Pipeline #459450 passed with stage
in 2 minutes and 1 second
......@@ -114,12 +114,22 @@ Assuming that ./submissions.zip is the zip file containing all submissions and .
python handlemoodlesubmissions.py --inzip ./submissions.zip --outfolder ./pdfs --csv ./Bewertungen.csv
```
#### Rename scanned PDFs
Rename scanned PDFs assuming scan order equal to alphabetical order of students in Moodle grading sheet.
Renames scans accordingly to info in Moodle grading sheet, such that the file name starts with the matriculation number. This only works if exams were scanned in alphabetical order. Optionally, each scanned PDF is searched for barcodes/QRs containing the matriculation number to double check.
```bash
python renamescans.py ./tests/assets/pdfs_scan ./tests/assets/Grades.csv ./tests/assets/pdfs
```
#### Prepare copies of Sample Solutions for each student (Optional)
We assume that the folder `./supplements` holds the scans of the sample solution.
We assume that the folder `./tests/assets/supplements` holds the scans of the sample solution.
```bash
python supplements.py
python supplements.py ./tests/assets/supplements ./tests/assets/Grades.csv ./tests/assets/pdfs
```
Folder `supplements_out` contains copies of the sample solutions for each student.
......
......@@ -87,6 +87,10 @@ def main(args):
starttime = time.time()
# Check folders
if not os.path.exists(outfolder):
os.makedirs(outfolder)
# Unzip submissions if provided zip archive
if inzip != "0":
if not os.path.exists(infolder):
......
......@@ -87,6 +87,10 @@ def main(args):
tmp_folder = args.tmp
extracted_folder = os.path.join(tmp_folder, "extracted_from_moodle")
# Check folders
if not os.path.exists(outfolder):
os.makedirs(outfolder)
# Print status
starttime = time.time()
num_students = moodle.get_student_number(sheet_csv=sheet_csv,
......
123001,u4KZmFV9
123002,9nnhC4nv
123010,AjH1vhi2
123011,n79WZpm4
......@@ -192,6 +192,12 @@ def main(args):
csv_enc = args.csvenc
size_limit = int(args.moodleuploadlimit) # Moodle upload size limit in MiB
# Check folders
zip_dir= outzip.rsplit('/',1)[0]
if not os.path.exists(zip_dir):
os.makedirs(zip_dir)
# Print status
starttime = time.time()
num_students = moodle.get_student_number(sheet_csv=sheet_csv,
......
......@@ -75,6 +75,10 @@ def main(args):
csv_enc = args.csvenc
check_qr = args.checkqr
# Check folders
if not os.path.exists(outfolder):
os.makedirs(outfolder)
# Print status with total number of lines
starttime = time.time()
dryout = ""
......
......@@ -125,6 +125,10 @@ def main(args):
csv_quote = args.csvquote
dry = args.dry
# Check folders
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Decide whether PDF folder or CSV file was given
csvfilename = pdf_dir = ""
ext = os.path.splitext(prefixinfo)[1].lower()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment