-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-exam-example.sh
executable file
·41 lines (31 loc) · 1.21 KB
/
create-exam-example.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Example to show all the steps to create and publish an exam
######## Just some book-keeping for the script, ignore it.
set -e
if [ -d "_private/2000-12-31" ] || [ -d "exams/2000-12-31" ] ; then
echo
echo " ERROR: example exam '2000-12-31' already exists ! You can safely delete it with "
echo
echo " python3 exam.py delete 2000-12-31"
echo
exit 1
fi
# Makes the bash script to print out every command before it is executed except echo
trap '[[ $BASH_COMMAND != echo* ]] && echo $BASH_COMMAND' DEBUG
###### end bookkeeping #####################################
python3 exam.py init 2000-12-31
python3 exam.py package --site --server 2000-12-31
echo
echo "------- Simulating some shipped exams..."
mkdir -p _private/2000-12-31/shipped/john-doe-112233
cp _templates/exam/solutions/*.py _private/2000-12-31/shipped/john-doe-112233
mkdir -p _private/2000-12-31/shipped/jane-doe-445566
cp _templates/exam/solutions/*.py _private/2000-12-31/shipped/jane-doe-445566
echo "------- Done with shipped exams simulation, time to grade ..."
echo
python3 exam.py grade 2000-12-31
python3 exam.py zip-grades 2000-12-31
python3 exam.py publish 2000-12-31
echo
echo ' Finished example exam run !!'
echo