Commit 451e99a1 authored by Amrita's avatar Amrita
Browse files

iss799 automate input

parent 8db53a7c
ID,"Vollständiger Name",Matrikelnummer,Status,Bewertung,"Status des Bewertungsworkflows","Bewertung kann geändert werden","Zuletzt geändert (Abgabe)","Zuletzt geändert (Bewertung)","Feedback als Kommentar"
Teilnehmer/in107,"Four, Student",123456,"Zur Bewertung abgegeben - Unbewertet",,Unbewertet,Ja,"Montag, 18. Mai 2020, 10:11",-,
Teilnehmer/in106,"One, Student",123457,"Keine Abgabe - Unbewertet",,Unbewertet,Ja,-,"Samstag, 16. Mai 2020, 12:15",-,
Teilnehmer/in105,"Three, Student",125412,"Keine Abgabe - Unbewertet",,Unbewertet,Ja,-,"Samstag, 16. Mai 2020, 12:15",-,
\ No newline at end of file
......@@ -3,6 +3,7 @@ import sys
import time
import argparse
import preparepdf
import supplements
import watermark
import encrypt
......@@ -52,6 +53,8 @@ Options:
help="Input folder with sample solutions. Default: ./supplements")
parser.add_argument("-w", "--sup", default="0",
help="Flag for watermarking sample solutions. 0 means no 1 means yes. Default: 0")
parser.add_argument("-x", "--zip", default="0",
help="Input zip file. Default: 0")
args = parser.parse_args(args)
......@@ -64,9 +67,16 @@ Options:
password = args.password
sup = int(args.sup)
supinfolder = args.supinfolder
inzip = args.zip
starttime = time.time()
# Unzip submissions if provided zip archive
if inzip != "0" :
if not os.path.exists(infolder):
os.makedirs(infolder)
preparepdf.main(['--in', inzip, '--out', infolder,'--csv', csv])
# Watermarking
watermark_outfolder = os.path.join(tmp, 'pdfs_watermarked')
if not os.path.exists(watermark_outfolder):
......
Identifier,"Full name","Registration number",Status,Grade,"Grade can be changed","Last modified (submission)","Last modified (grade)"
"Participant 89","One, Student",123001,"Submitted for grading",,Yes,"Wednesday, 3 March 2021, 12:50 PM",-
"Participant 88","Three, Student",123002,"Submitted for grading",,Yes,"Wednesday, 3 March 2021, 12:51 PM",-
"Participant 87","Four, Student",123003,"Submitted for grading",,Yes,"Wednesday, 3 March 2021, 12:52 PM",-
"Participant 86","Five, Student",123004,"Submitted for grading",,Yes,"Wednesday, 4 March 2021, 13:52 PM",-
"Participant 85","Six, Student",123005,"Submitted for grading",,Yes,"Wednesday, 5 March 2021, 14:52 PM",-
"Participant 84","Seven, Student",123006,"Submitted for grading",,Yes,"Wednesday, 3 March 2021, 12:51 PM",-
"Participant 83","Eight, Student",123007,"Submitted for grading",,Yes,"Wednesday, 3 March 2021, 12:51 PM",-
\ No newline at end of file
......@@ -45,7 +45,6 @@ def main(args):
print('\n***ERROR*** Something went wrong. Check if you have given the correct name and path for the zip file')
return
with open(csvfilename, newline='') as csvfile:
matnums = []
moodleids={}
......@@ -85,12 +84,12 @@ def main(args):
for filename in [f for f in filenames if not f.endswith(".pdf")]:
unsupported_files.append(filename)
if unsupported_files: #Lists all non-PDF files found in a student's submission
print('This script only supports PDF files. Hence the below files cannot be handled:')
for filename in unsupported_files:
print('- '+filename)
if unsupported_files: #Lists all non-PDF files found in a student's submission
print('This script only supports PDF files. Hence the below files cannot be handled:')
for filename in unsupported_files:
print('- '+filename)
if __name__ == '__main__':
main(sys.argv[1:])
\ No newline at end of file
main(sys.argv[1:])
File added
......@@ -123,10 +123,11 @@ Files in output folder {} will be overwritten during this process.
""".format("\n- ".join(supp_files), output_dir))
# Create prefixes
print(pdf_dir)
if pdf_dir != "": # Take prefixes from pdf directory
pdf_folder = os.listdir(pdf_dir)
pdf_files = [_ for _ in pdf_folder
if _.endswith(".pdf") and utils.check_matnum(_.rsplit('_', 1)[0])]
if _.endswith(".pdf") and utils.check_matnum(_.split('_', 1)[0])]
prefixes = []
for pdf_file in pdf_files:
prefix = os.path.splitext(pdf_file)[0] # take file name as prefix
......
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