From 7ea93eb50c893d9201ddb1418b57549e67850228 Mon Sep 17 00:00:00 2001 From: Dominika Liberda Date: Thu, 10 Jun 2021 22:20:03 +0000 Subject: [PATCH] * fixes data duplicates in graph rendering --- webroot/uwu.shs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webroot/uwu.shs b/webroot/uwu.shs index 1523901..698a422 100644 --- a/webroot/uwu.shs +++ b/webroot/uwu.shs @@ -15,6 +15,7 @@ start_date="$(jq -r '.date' < $data | tail -n $lim | head -n1)" end_date="$(jq -r '.date' < $data | tail -n1)" tmp="$(mktemp)" type="$(jq -r '.type' < $data | head -n 1)" +a='' if [[ "$type" == "ping" ]]; then timedata="$(jq -r '.time' < $data | tail -n $lim)" @@ -39,10 +40,10 @@ elif [[ "$type" == "req" ]]; then done <<< "$(jq -r '"Name: \(.label)\\\\nDate: \(.date)"' < "$data" | tail -n $lim)" > $tmp elif [[ "$type" == "port" ]]; then timedata="$(jq -r '.status' < $data | tail -n $lim)" - for i in $timedata; do - if [[ "$i" -gt 0 ]]; then + for ii in $timedata; do + if [[ "$ii" -gt 0 ]]; then a="${a}0#" - elif [[ "$i" == 0 ]]; then + elif [[ "$ii" == 0 ]]; then a="${a}1#" fi done