commit 6ff63abe839783684134fafb3932857d0de8c3fc
parent ef30ec8e55603a8bc5d008845278bb9e520405c6
Author: Daniel Gultsch <daniel@gultsch.de>
Date: Mon, 23 Jan 2017 00:39:31 +0100
modified tojson and tohtml scripts to deal with variable number of tests
Diffstat:
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/reports/tohtml.php b/reports/tohtml.php
@@ -108,7 +108,13 @@ function calc_score($report) {
return $score;
}
$reports = json_decode(file_get_contents('complete.json'),true);
-$headers = array_keys(reset($reports));
+$headers = array();
+foreach($reports as &$report) {
+ $h = array_keys($report);
+ if (count($h) > count($headers)) {
+ $headers = $h;
+ }
+}
if (count($argv) >= 2 && $argv[1] === 'ranked') {
usort($headers, "comp_header");
uasort($reports, "comp_report");
diff --git a/reports/tojson.sh b/reports/tojson.sh
@@ -6,7 +6,9 @@ echo -n '{'
for report in "${reports[@]}"; do
server=$(echo $report | sed 's/.txt//')
echo -n "\"$server\":"
- echo -n '{' ; grep -B 14 'Conversations Compliance Suite: ' $report | head -n 12 | sed 's/running //' | sed 's/…//' | sed -e 's/ \{3,\}/\t\t/g' | awk -F '\t\t' '{ printf "\"" $1 "\":\"" $2 "\""; if (NR != 12) printf "," }'; echo -n '}'
+ lines=`grep -B 16 'Conversations Compliance Suite: ' $report | grep running | wc -l`
+ context=`echo $lines + 2 | bc`
+ echo -n '{' ; grep -B $context 'Conversations Compliance Suite: ' $report | head -n $lines | sed 's/running //' | sed 's/…//' | sed -e 's/ \{3,\}/\t\t/g' | awk -v lines="$lines" -F '\t\t' '{ printf "\"" $1 "\":\"" $2 "\""; if (NR != lines) printf "," }'; echo -n '}'
if [[ $report != $last ]]; then echo -n ','; fi;
done;
echo '}'