]> git.plutz.net Git - lobster/commitdiff
Link to therapies without relying on prescriptions
authorPaul Hänsch <paul@plutz.net>
Wed, 8 Jan 2020 21:54:24 +0000 (22:54 +0100)
committerPaul Hänsch <paul@plutz.net>
Wed, 8 Jan 2020 21:54:24 +0000 (22:54 +0100)
cards/l10n.sh
cards/widgets.sh

index ec02d65f19b7dd2c87cb094e4a2834e3be6baac7..b0930c1f5e6b4e878b6edd9b0f686b55c94a8ffe 100755 (executable)
@@ -85,6 +85,7 @@ l10n(){
     prescriptions) printf %s "Verordnungen";;
     new_prescription) printf %s "Neue Verordnung";;
     no_icd) printf %s "Kein ICD Code";;
+    therapy) printf %s "Therapie";;
     therapies) printf %s "Therapien";;
   
     X-ZACK-JOINDATE)  printf %s "An&shy;mel&shy;de&shy;da&shy;tum";;
index d2ed32611932d5fd9bf7067b904679892f797e69..ac04d9f74066638940ad93fbe2f8f5509f78ee87 100755 (executable)
@@ -135,12 +135,16 @@ card_item(){
       therapies)
         client="$(pdi_value "$card" UID)"
         printf '[h3 %s]' "$(l10n therapies)"
-        (cd "$_DATA/prescriptions/"; printf '%s\n' "${client}".*.mpx) \
-        | while read mpxfile; do
-          [ "$mpxfile" = "${client}.*.mpx" ] && break
-          mpx="${mpxfile%.mpx}";
-          printf '[a .item .therapy href="/therapies/%s" . Therapy - %s]' \
-            "${mpx%.*}/${mpx#*.}" "$(sed -E '/^date:.*/{s;^date:;;;q;};d;' "$_DATA/prescriptions/$mpxfile")"
+        (cd "$_DATA/therapies/"; printf '%s\n' "${client}".*.tpy) \
+        | while read tpyfile; do
+          [ "$tpyfile" = "${client}.*.tpy" ] && break
+          tpy="${tpyfile%.tpy}";
+          tpydates="$(sed -En 's;^session[0-9]+_date:;;p;' "$_DATA/therapies/$tpyfile" \
+                      | sort \
+                      | sed -E ':X;N;$!bX; s;^[\n ]+;;; s;[\n ]+$;;; s;(\n.*\n|\n); - ;;'
+                     )"
+          printf '[a .item .therapy href="/therapies/%s" . %s %s]' \
+                 "${tpy%.*}/${tpy#*.}" "$(l10n therapy)" "$(HTML "${tpydates:--}")"
         done |sort -r
         ;;
       *)[ $cnt -gt 0 ] && printf '[h3 %s]' "$(l10n "$item")"