- # attendance=()
- # for att in attendance attendance{0..100}; do
- # [ -n "${_POST[$att]}" ] && attendance+=("${_POST[$att]}")
- # done
- # sed -rn 's:^(.+)'$card'$:\1:p' "$attfile" |while read course; do
- # touch "$_DATA/ical/$course"
- # done
- # sed -i -r '/^(.+)\t'$card'$/d' "$attfile"
- # for each in $attendance; do
- # echo "$each\t$card"
- # done >>"$attfile"
- # sed -rn 's:^(.+)'$card'$:\1:p' "$attfile" |while read course; do
- # touch "$_DATA/ical/$course"
- # done
+ if LOCK "$attfile"; then
+ grep -F " ${card}" "$attfile" |while read course junk; do
+ touch "$_DATA/ical/${course}"
+ done
+ sed -i -E "/^.+ ${card}\$/d" "$attfile"
+ seq 1 $(POST_COUNT attendance) |while read n; do
+ printf '%s %s\n' "$(POST attendance $n)" "$card"
+ done >>"$attfile"
+ grep -F " ${card}" "$attfile" |while read course junk; do
+ touch "$_DATA/ical/${course}"
+ done
+ RELEASE "$attfile"
+ else
+ SET_COOKIE 0 message="COULD NOT UPDATE COURSE MAPPINGS"
+ fi