X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=therapies%2Fupdate_therapy.sh;h=406f4f983ca809d53bb94e13c2f559bc36440869;hb=c035ac5cd677c1c016143901de4e6a2965829610;hp=ec8ccdc0878128c43a27872cecfcd26b1bcdf60f;hpb=90041d8be2590c270a69f1eb44b882a863491aca;p=lobster diff --git a/therapies/update_therapy.sh b/therapies/update_therapy.sh index ec8ccdc..406f4f9 100755 --- a/therapies/update_therapy.sh +++ b/therapies/update_therapy.sh @@ -26,7 +26,40 @@ tempfile="$_DATA/temp/${tpy}.tpy" # serialize POST array into file for key in $(POST_KEYS); do - [ "$key" != imagedata ] && printf %s:%s\\n "$key" "$(POST "$key" |sed ':X;N;$!bX; s;\n;\\n;g;')" + case "$key" in + imagedata) true ;; + session*_date) + value="$(POST "$key" |sed ':X;N;$!bX; s;\n;\\n;g;')" + y=0 mon=0 dom=0 + case $value in + *.*.*) IFS=. read dom mon y <<-END + ${value} + END + ;; + *.*.) IFS=. read dom mon <<-END + ${value} + END + ;; + */*/*) IFS=/ read mon dom y <<-END + ${value} + END + ;; + */*) IFS=/ read mon dom <<-END + ${value} + END + ;; + *-*-*) IFS=- read y mon dom <<-END + ${value} + END + ;; + esac + [ ! "$y" ] && y="$(date +%Y)" + [ "$y" -gt 0 -a "$y" -lt 100 ] && y="$((y + 2000))" + date -d "${y}-${mon}-${dom}" + && printf %s:%s\\n "$key" "$(date -d "${y}-${mon}-${dom}" +%F)" \ + || printf %s:\\n "$key" + ;; + *) printf %s:%s\\n "$key" "$(POST "$key" |sed ':X;N;$!bX; s;\n;\\n;g;')" ;; + esac done >"$tempfile" if [ "$(POST delete_session)" ]; then @@ -65,5 +98,6 @@ elif [ "$(POST imagedata)" ]; then fi mv "$tempfile" "$tpyfile" +rm -f "${_DATA}/cache/${tpy%%.*}.vcf.cache" REDIRECT "/therapies/${tpy%.*}/${tpy#*.}"