Commit 42a19403 authored by Olivier's avatar Olivier
Browse files

Module 11: generate PDFs to be sent to participants once grading completes

parent a421165a
#!/bin/bash
# Input parameters
inputfolder='script_input'
outputfolder='script_output'
# Prepare output folder
mkdir -pv $outputfolder/done
# Copy input into the output folder, change directory to output folder
cp -vrf $inputfolder/* $outputfolder/
cd $outputfolder
mkdir "done"
# Pick up all the files in input subfolder one by one
for submissionpdf in submissions/*.pdf; do
# Extract IDA code from submission pdf file name
IDA=$(echo "$submissionpdf" | sed -r 's/submissions\///' | sed -r 's/\.pdf//')
echo "#"
echo "#"
echo "building assignment PDF for $IDA …"
mv -v solutions/graded_solution1_$IDA.pdf ./solution.pdf
mv -v submissions/$IDA.pdf ./submission.pdf
# Concatenate all three PDFs that we have together now
# Note that pdftk is not available by default on Ubuntu 18.04,
# see https://askubuntu.com/a/1046476 for workaround install
pdftk A=solution.pdf B=submission.pdf cat A B output done/Solution_submisison_1_$IDA.pdf
done
echo "#"
echo "#"
echo "#"
echo "done building PDFs"
# Cleanup: remove temporary folders
rm -rvf form solutions submissions solution.pdf submission.pdf
cd ../
echo "end of script."
#!/bin/bash
# Input parameters
inputfolder='script_input-real'
outputfolder='script_output-real'
timestamp=$(date "+%Y-%m-%d+%H%M%S")
outputbackupname="backup_output_$timestamp.tar"
inputbackupname="backup_input_$timestamp.tar"
# Create archive of output folder
mkdir -vp archives
tar -cvf $outputbackupname --exclude=old $outputfolder
mv -vf $outputbackupname archives/
tar -cvf $inputbackupname --exclude=old $inputfolder
mv -vf $inputbackupname archives/
# Import output of M3 and M5 into input of M11
rsync -avh --delete ../M5_collect_submissions/renamed\ pdfs/ $inputfolder/submissions/
rsync -avh --delete ../M3_generate_assignments/script_output/graded* $inputfolder/solutions/
# Clear output folder
rm -rvf $outputfolder/*
echo "end of script."
......@@ -21,7 +21,7 @@ The code in this repository is published under the [GNU GPL v3](href="https://ww
## Structure
A total of 11 modules (8 of which being locally-run scripts) are needed to run the project.
A total of 12 modules (9 of which being locally-run scripts) are needed to run the project.
[ ] Module 1: Collect participant information
(through email)
......@@ -53,5 +53,8 @@ A total of 11 modules (8 of which being locally-run scripts) are needed to run t
[x] [Module 10](M10_process_grades): Process grades
(in Python)
[ ] Module 11: Send results to students
[x] [Module 11](M11_generate_graded): Generate graded PDFs
(in bash, with pdftk)
[ ] Module 12: Send results to students
(in Python)
Supports Markdown
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