Skip to content

Commit

Permalink
Improves common grading functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dbosk committed Sep 5, 2024
1 parent 87134c8 commit b108fd2
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions adm/grading/common.sh.nw
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,38 @@ with the time of the latest submission (or rather grading time).
The first function will take the course code as first argument, the assignment
title as the second.
The output will be a list of KTH usernames, that is without @kth.se at the end.

In case the regexes for course and assignments match several courses, we sort
and return only unique students.
So that we don't grade the same student twice.
<<function returning students to grade>>=
students_to_grade() {
canvaslms submissions -l -c "${1}" -a "${2}" | grep -v P | \
cut -f 3 | sed "s/@kth.se//"
canvaslms submissions -l -c "${1}" -a "${2}" \
| <<exclude those who passed>> \
| cut -f 3 \
| sort -u \
| sed "s/@kth.se//"
}
<<exclude those who passed>>=
egrep -v "\sP\s"
@

For the second function, we want to find out which repos have been graded
before and at what time.
For the second function, we want to find out who have been graded before and at
what time.
This function takes the course as first argument, assignment as the second; it
returns the student Canvas identifier (first column), student KTH identifier
(second column) and a time stamp of last grading (all zeroes for those who
haven't been graded before, third column).
returns the student KTH identifier (third column) and a time stamp of last
grading (sixth column).

For those who haven't been graded before, the last column will be empty.
So we rewrite that to an all-zero date.
<<function returning students to grade with last grading time>>=
students_with_grading_time() {
canvaslms submissions -l -c "$1" -a "$2" | \
grep -v P | cut -f 3,6 | sed "s/None/0000-00-00/" | sed "s/@kth.se//"
canvaslms submissions -l -c "$1" -a "$2" \
| <<exclude those who passed>> \
| cut -f 3,6 \
| sort -u \
| sed -E "s/\s$/0000-00-00/" \
| sed "s/@kth.se//"
}
@

Expand Down Expand Up @@ -92,7 +107,7 @@ students_to_actually_grade() {
local repos=$1

for s in $(echo "$students_w_times" | cut -f 1); do
time=$(echo "$students_w_times" | egrep "^$s[^a-z0-9]" | cut -f 2)
time=$(echo "$students_w_times" | egrep "^$s\s" | cut -f 2)

for r in $(find $repos/$s -mindepth 1 -maxdepth 1 -type d 2>/dev/null); do
if [[ "$time" < "$(git -C $r log -1 --format=\%cI 2>/dev/null)" ]]; then
Expand Down

0 comments on commit b108fd2

Please sign in to comment.