-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2437ff
commit 183b09f
Showing
16 changed files
with
5,039 additions
and
79 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Example of multi-instance configuration | ||
// In order to use this config file, rename it to exam-config.js | ||
|
||
const INSTANCE = process.env.JS_TEST_INSTANCE; | ||
const LOCAL_TEST_MODE = typeof INSTANCE === 'undefined'; | ||
|
||
module.exports = { | ||
|
||
// Instance names (i.e. one per Firebase project, with separate hosting and database) | ||
instances: [ 'instance1', 'instance2', 'instance3' ], // => npm run deploy-firebase-instances | ||
|
||
// Front-end config | ||
title: 'JavaScript Exam (' + (LOCAL_TEST_MODE ? 'DEFAULT' : INSTANCE) + ')', | ||
|
||
// General settings | ||
PUBLIC_TEST_MODE: true, // set to false to restrict acccess and identify students using Google Login | ||
DISPLAY_SOLUTIONS_AFTER_SUBMIT: true, // set to false, for real exams | ||
|
||
redirectToHttps: false, | ||
|
||
// Settings for conversion and publication of exercise templates | ||
examPack: { | ||
publishSolutions: true, // `true` required for realtime-eval/auto-eval back-ends, DISPLAY_SOLUTIONS_AFTER_SUBMIT and/or dashboard | ||
publishEvalTests: LOCAL_TEST_MODE, // `true` required for realtime-eval/auto-eval back-ends, DISPLAY_SOLUTIONS_AFTER_SUBMIT and/or dashboard | ||
}, | ||
|
||
// Back-end config | ||
backend: { | ||
type: LOCAL_TEST_MODE ? 'auto-eval' : 'firebase', | ||
/* | ||
EMAIL_SUBMIT_CONFIG: { | ||
mdTemplate: readfile('public/data/submitted.md'), | ||
}, | ||
*/ | ||
FIREBASE_CONFIG: { | ||
'instance1': { | ||
apiKey: "kjgkerjghkrjghkerjg-kjgeklrja", | ||
databaseURL: "https://jsexam-1.firebaseio.com", | ||
messagingSenderId: "847593487934867" | ||
}, | ||
'instance2': { | ||
apiKey: "kjgkerjghkrjghkerjg-kjgeklrjb", | ||
databaseURL: "https://jsexam-2.firebaseio.com", | ||
messagingSenderId: "847593487934868" | ||
}, | ||
'instance3': { | ||
apiKey: "kjgkerjghkrjghkerjg-kjgeklrjc", | ||
databaseURL: "https://jsexam-3.firebaseio.com", | ||
messagingSenderId: "847593487934869" | ||
}, | ||
}[ LOCAL_TEST_MODE ? 'instance1' : INSTANCE ], | ||
}, | ||
|
||
teacherEmail: 'teacher.email@domain.com', // required for dashboard auth | ||
|
||
// Authentication | ||
GOOGLE_CLIENT_ID: '7465834756-rkjgelkhjlerkgjlerkgjelrkg.apps.googleusercontent.com', // generated from https://console.developers.google.com/apis/credentials?project=eemi-own-exam&authuser=1 | ||
GOOGLE_CLIENT_DOMAIN: 'domain.com', // to restrict access to users from a certain domain only | ||
LOGIN_INVITE: 'Connect using your Google for Education account:', | ||
|
||
// Evaluation / grading | ||
quizzGrading: { | ||
ptsRight: 1, | ||
ptsWrong: 0, // or -0.5 for example | ||
ptsNull: 0, | ||
}, | ||
codeGrading: { | ||
ptsPerExercise: 1, | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# This script evaluates students from Firebase JSON exports, to log and csv formats. | ||
# (one student grade per line) | ||
|
||
# Usage: ./eval-firebase-dumps.sh ./exam-data/*.json | ||
|
||
rm ./exam-data/score*.* &>/dev/null | ||
|
||
for FILEPATH in $*; | ||
do | ||
FILENAME=$(basename "$FILEPATH") | ||
EVAL_DIR="${FILENAME%.*}" | ||
EVAL_PATH=exam-data/$EVAL_DIR | ||
|
||
echo "* Evaluating $FILEPATH to $EVAL_PATH/ ..." | ||
mkdir $EVAL_PATH &>/dev/null | ||
node ./src/evaluateGroupFile.js ".$FILEPATH" &>$EVAL_PATH/eval.log | ||
./src/split-eval-log-per-student.sh $EVAL_PATH/eval.log >/dev/null | ||
mv Eval_*.txt $EVAL_PATH/ | ||
mv exam-data/score*.* $EVAL_PATH/ | ||
done; | ||
|
||
echo "✅ Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# This script evaluates students from Firebase databases (1 instance per class), | ||
# to log and csv formats (1 student grade per line). | ||
|
||
CONFIG_FILE=./exam-data/exam-config.js | ||
|
||
INSTANCES=() | ||
ARRAY=`node -e "console.log(require('$CONFIG_FILE').instances.join(';'));"` | ||
IFS=';' read -ra INSTANCES <<< "$ARRAY" | ||
|
||
echo "* Cleaning up and rebuilding eval testers ..." | ||
rm ./exam-data/score*.* &>/dev/null | ||
npm run build >/dev/null | ||
|
||
for INSTANCE in "${INSTANCES[@]}" | ||
do | ||
INST_PATH=exam-data/$INSTANCE | ||
DATABASE_URL=`JS_TEST_INSTANCE=$INSTANCE node -e "console.log(require('$CONFIG_FILE').backend.FIREBASE_CONFIG.databaseURL);"` | ||
|
||
echo "* Evaluating students from instance $INSTANCE to $INST_PATH ..." | ||
mkdir $INST_PATH &>/dev/null | ||
JS_TEST_INSTANCE=$INSTANCE npm run eval >$INST_PATH/eval.log | ||
# (or) JS_TEST_INSTANCE=$INSTANCE node ./src/evaluateGroupFile.js ../exam-data/$INSTANCE.json >$INST_PATH/eval.log | ||
|
||
./src/split-eval-log-per-student.sh $INST_PATH/eval.log >/dev/null | ||
mv Eval_*.txt $INST_PATH/ | ||
mv exam-data/score*.* $INST_PATH/ | ||
done | ||
|
||
echo "✅ Done!" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# This script evaluates students from email submissions, to log and csv formats. | ||
# (one student grade per line) | ||
|
||
# Usage: ./eval-student-submissions.sh ./students/*.json | ||
|
||
rm ./exam-data/score*.* &>/dev/null | ||
|
||
for FILEPATH in $*; | ||
do | ||
EVAL_PATH=exam-data/email-submissions | ||
FILENAME=$(basename "$FILEPATH") | ||
STUDENT_NAME="${FILENAME%.*}" | ||
|
||
echo "* Evaluating $FILEPATH to $EVAL_PATH/ ..." | ||
mkdir $EVAL_PATH &>/dev/null | ||
node ./src/evaluateStudentFile.js ".$FILEPATH" &>$EVAL_PATH/Eval_$STUDENT_NAME.txt | ||
done; | ||
|
||
mv exam-data/score*.* $EVAL_PATH/ | ||
echo "✅ Done!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# (forked from https://github.com/adrienjoly/js-exam/blob/master/deploy.sh) | ||
|
||
# This script deploys this app to the following *.firebaseapp.com subdomains: | ||
instances=( jsp1-cl1 jsp1-cl2 jsp1-cl3 ) | ||
|
||
# ...by temporarily altering the corresponding mentions to js-exam in the following files: | ||
files=( ./exam-data/exam-config.js ) | ||
|
||
# initial mentions to be replaced: | ||
initial="__INSTANCE__" | ||
|
||
for instance in "${instances[@]}" | ||
do | ||
echo "Deploying to instance: $instance .firebaseapp.com ..." | ||
|
||
for f in "${files[@]}" | ||
do | ||
echo "- replacing mentions of $initial in file: $f" | ||
mv $f $f.bak | ||
replacement="s/$initial/$instance/g" | ||
sed $replacement $f.bak > $f | ||
done | ||
|
||
npm run build | ||
git status -s | ||
|
||
# Push them to Firebase hosting, then repent of the commit (cf http://rhodesmill.org/brandon/2012/quietly-pushing-to-heroku/) | ||
#git add . | ||
git commit -am 'Temporary Firebase-only deployment commit' | ||
firebase use $instance && firebase deploy | ||
git reset --soft HEAD~1 | ||
|
||
for f in "${files[@]}" | ||
do | ||
echo "- restoring mentions to $instance in file: $f" | ||
rm $f | ||
mv $f.bak $f | ||
done | ||
|
||
done | ||
|
||
npm run build |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# Splits a given eval.log file to 1 file per student (./Eval_<student_name>.txt). | ||
|
||
perl -pwe ' | ||
if (/^STUDENT: (.+)/) { | ||
open $out, ">", "Eval_$1.txt" or die $!; | ||
select $out; | ||
}' $1 |