From 9cd75dbdcf36314dd222357864aa275b2bd91850 Mon Sep 17 00:00:00 2001 From: "Kyle M. Lang" Date: Mon, 4 Nov 2024 17:51:43 +0100 Subject: [PATCH] adding/modifying scripts to process A3 grading allocation --- bin/divide_grading.sh | 29 +++++++++++++++++++++++++++++ bin/process_assignments.sh | 33 +++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 bin/divide_grading.sh diff --git a/bin/divide_grading.sh b/bin/divide_grading.sh new file mode 100644 index 0000000..16cf93c --- /dev/null +++ b/bin/divide_grading.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +### Title: Divide TCSM Grading +### Author: Kyle M. Lang +### Created: 2024-11-04 +### Modified: 2024-11-04 + +### Description: +# This script should divide the grading load among the teachers as defined in the +# JSON file specified in the first argument. + +### Usage: +# ./divide_grading.sh ASSIGNMENT_ALLOCATION.json SUBMISSION_DIRECTORY + +SUB_DIR=`echo $2 | sed -e 's/\\///'` + +for TEACHER in `jq -r 'keys.[]' $1`; do + echo "Processing $TEACHER's assignment." + + if [ ! -d $TEACHER ]; then + mkdir $TEACHER + fi + + for ID in `jq -r .$TEACHER.[] $1`; do + if [ -d $SUB_DIR/$ID ]; then + cp -r $SUB_DIR/$ID $TEACHER/$ID + fi + done +done diff --git a/bin/process_assignments.sh b/bin/process_assignments.sh index ea9841d..2a81de4 100644 --- a/bin/process_assignments.sh +++ b/bin/process_assignments.sh @@ -3,34 +3,43 @@ ### Title: Process TCSM Assignment Submissions ### Author: Kyle M. Lang ### Created: 2024-10-03 -### Modified: 2024-10-03 +### Modified: 2024-11-04 ### Description: # This script should automagically process the assignment downloads from BB # 1. Unzip the download archive and move the download archive to ./tmp/ # 2. Replace all spaces in filenames with underscores -# 3. Remove all BB boilerplate from filenames and start each filename with gNN -# 4. Parse the file names to extract the group numbers and create a directory for each group -# 5. Move all a group's files to their directory +# 3. Remove all BB boilerplate from filenames and give the files consistent names +# 4. Parse the file names to extract the group numbers/student IDs and create a directory for each +# 5. Move all relevant files to the matching directory ### Usage: -# ./process_assignments.sh BB_DOWNLOAD_FILE.zip +# ./process_assignments.sh ASSIGNMENT_NUMBER BB_DOWNLOAD_FILE.zip function lss () { ls --ignore=*.sh -p | grep -v /$ } -unzip "$1" +unzip "$2" mkdir tmp -mv "$1" tmp/ +mv "$2" tmp/ rename.ul --all " " "_" ./* +if [ "$1" -eq "3" ]; then + s0='s/^Assignment_3_//' +else + s0='s/^.*Group_/g/' +fi + for x in `lss`; do - f=`echo $x | sed 's/^.*Group_/g/'` - # mv $x $f - d=`echo $f | sed 's/[[:punct:]].*$//'` - mkdir $d + f=`echo $x | sed -e $s0 -e 's/_.*\\././'` + d=`echo $f | sed 's/\\..*//'` + + if [ ! -d "$d" ]; then + mkdir $d + fi + mv $x $d/$f -done; +done