aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-10-05 21:47:36 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-10-05 21:47:36 +0200
commitf235bb7a097b1fd513b8233f688b6f143713fe78 (patch)
tree0f4142b6dffd7056f8ea7436673bf7d2e47dbbe6
parent03206b8bdc3e2a14ee6ff85b9cb606559130181f (diff)
downloadunterricht-f235bb7a097b1fd513b8233f688b6f143713fe78.tar.gz
unterricht-f235bb7a097b1fd513b8233f688b6f143713fe78.zip
add script to find past lessons for a topic
-rwxr-xr-xscripts/find-past-lessons16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/find-past-lessons b/scripts/find-past-lessons
new file mode 100755
index 00000000..96229220
--- /dev/null
+++ b/scripts/find-past-lessons
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Copyright 2025 Florian Fischer
+
+# Find Unterricht root
+ROOT="${PWD/\/Unterricht\/*//Unterricht}"
+if [ -z "${ROOT}" ]; then
+ exit 1
+fi
+
+LESSON="$(realpath "${1:-"${PWD}"}")"
+while read -r topic; do
+ lesson="$(realpath "${topic}")"
+ if [ "$(realpath "${lesson}")" = "${LESSON}" ]; then
+ dirname "${topic}"
+ fi
+done <<< "$(find "${ROOT}" -type l -path "*_*/*topic*")"