]> git.plutz.net Git - lobster/commitdiff
remove course mapping when deleting card file
authorPaul Hänsch <paul@plutz.net>
Mon, 18 Jan 2021 17:02:35 +0000 (18:02 +0100)
committerPaul Hänsch <paul@plutz.net>
Mon, 18 Jan 2021 17:02:35 +0000 (18:02 +0100)
cards/update_card.sh

index 97dedf3d646cfe618b6389dacee08949bcb46ede..bf8bce170698a24fd0ed914a7945160b86616500 100755 (executable)
@@ -131,6 +131,15 @@ case "$action" in
   delete)
     rm "$cardfile"
     RELEASE_SLOCK "$cardfile"
+    if LOCK "$attfile"; then
+      grep -F "        ${card}" "$attfile" |while read course junk; do
+        touch "$_DATA/ical/${course}"
+      done
+      sed -i -E "/^.+  ${card}\$/d" "$attfile"
+      RELEASE "$attfile"
+    else
+      SET_COOKIE 0 message="COULD NOT UPDATE COURSE MAPPINGS"
+    fi
     REDIRECT "/cards/?o=${order}&f=${filter}"
     ;;
 esac