From 3c0cb388e64834c7476d2734d046c6f2fc646606 Mon Sep 17 00:00:00 2001 From: mattbk Date: Sun, 1 Nov 2015 09:34:49 -0600 Subject: [PATCH] Raw results are working and downloadable --- index.php | 28 ++----------------- views/results.html.twig | 61 ++++++++++++++++++++--------------------- views/results.txt.twig | 7 ++--- 3 files changed, 36 insertions(+), 60 deletions(-) diff --git a/index.php b/index.php index c9c0ad5..7087e93 100755 --- a/index.php +++ b/index.php @@ -164,7 +164,7 @@ switch ($mode) { if ($download) { header('Content-Type: text/tab-separated-values'); - header('Content-Disposition: attachment; filename=vcd-results.txt'); + header('Content-Disposition: attachment; filename="results.txt"'); $template = 'results.txt.twig'; } else { @@ -173,16 +173,11 @@ switch ($mode) { if ($filtered) { $variables['filtered'] = true; - // $results = $db->query("select * from vcd_results where result_host != '192.168.0.1' order by result_date asc"); $results = $db->query("select * from results where host != '192.168.0.1' order by datetime asc"); - } - + } else { -//This query needs to be rewritten to use the results table (EAV version), -// but hopefully format the data in the same way (in the query itself, if possible?) - //$results = $db->query("select * from vcd_results order by result_date asc"); $results = $db->query("select * from results order by datetime asc"); - } + } if ($results === false) { header('HTTP/1.0 500 Internal Server Error'); @@ -216,23 +211,6 @@ switch ($mode) { } //End while to loop through results from database. - echo "
";
-	   print_r($variables['data']);
-    echo "
"; - -// Build statistics -//Stats are calculated before results are put into the database -// foreach ($variables['data'] as $key=>$value) { -// //print_r($value['phase']); -// $stats[] = array( -// 'correct' => (($value['xcoordinate'] >= $settings->elementLocations->{$value['phase'] }->topleft->x) -// && ($value['xcoordinate'] < $settings->elementLocations->{$value['phase']}->bottomright->x) -// && ($value['ycoordinate'] >= $settings->elementLocations->{$value['phase']}->topleft->y) -// && ($value['ycoordinate'] < $settings->elementLocations->{$value['phase']}->bottomright->y)), -// 'time' => $value['responsetime'] -// ); -// } -// $variables['stats'] = $stats; $results->free(); break; diff --git a/views/results.html.twig b/views/results.html.twig index dc42f33..e80de42 100644 --- a/views/results.html.twig +++ b/views/results.html.twig @@ -4,7 +4,9 @@ + {% if allow_filtering %}
Filtered results @@ -12,6 +14,7 @@
{% endif %} + + -->

Raw results

-

Download results

+

Download results

+ + + - - - - - - - - - - - - - + + + + + {% for record in data %} - - - - - - - - - - + + + + + + + + {% endfor %}
#NotableUnnotedRenoted
xytimexytimeuiddatehostphase x y timescore
{{ loop.index }}.{{ record.notable.xcoordinate }}{{ record.notable.ycoordinate }}{{ record.notable.responsetime }}{{ record.unnoted.xcoordinate }}{{ record.unnoted.ycoordinate }}{{ record.unnoted.responsetime }}{{ record.renoted.xcoordinate }}{{ record.renoted.ycoordinate }}{{ record.renoted.responsetime }}{{record.uid}}.{{ record.datetime }}{{ record.host }}{{ record.phase }}{{ record.xcoordinate }}{{ record.ycoordinate }}{{ record.responsetime }}{{ record.score }}
+ {% endblock %} \ No newline at end of file diff --git a/views/results.txt.twig b/views/results.txt.twig index 8cbaae2..a374d69 100644 --- a/views/results.txt.twig +++ b/views/results.txt.twig @@ -1,5 +1,4 @@ -notable unnoted renoted -x y time x y time x y time -{% for result in data %} -{{result.notable.xcoordinate}} {{result.notable.ycoordinate}} {{result.notable.responsetime}} {{result.unnoted.xcoordinate}} {{result.unnoted.ycoordinate}} {{result.unnoted.responsetime}} {{result.renoted.xcoordinate}} {{result.renoted.ycoordinate}} {{result.renoted.responsetime}} +uid datetime host phase xcoordinate ycoordinate responsetime score +{% for record in data %} +{{record.uid}} {{record.datetime}} {{record.host}} {{record.phase}} {{record.xcoordinate}} {{record.ycoordinate}} {{record.responsetime}} {{record.score}} {% endfor %}