Raw results are working and downloadable
This commit is contained in:
28
index.php
28
index.php
@ -164,7 +164,7 @@ switch ($mode) {
|
|||||||
|
|
||||||
if ($download) {
|
if ($download) {
|
||||||
header('Content-Type: text/tab-separated-values');
|
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';
|
$template = 'results.txt.twig';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -173,16 +173,11 @@ switch ($mode) {
|
|||||||
|
|
||||||
if ($filtered) {
|
if ($filtered) {
|
||||||
$variables['filtered'] = true;
|
$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");
|
$results = $db->query("select * from results where host != '192.168.0.1' order by datetime asc");
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
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");
|
$results = $db->query("select * from results order by datetime asc");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($results === false) {
|
if ($results === false) {
|
||||||
header('HTTP/1.0 500 Internal Server Error');
|
header('HTTP/1.0 500 Internal Server Error');
|
||||||
@ -216,23 +211,6 @@ switch ($mode) {
|
|||||||
|
|
||||||
} //End while to loop through results from database.
|
} //End while to loop through results from database.
|
||||||
|
|
||||||
echo "<pre>";
|
|
||||||
print_r($variables['data']);
|
|
||||||
echo "</pre>";
|
|
||||||
|
|
||||||
// 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();
|
$results->free();
|
||||||
break;
|
break;
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
<header class="page-header">
|
<header class="page-header">
|
||||||
<h1>Change blindness results</h1>
|
<h1>Change blindness results</h1>
|
||||||
</header>
|
</header>
|
||||||
|
<!--
|
||||||
<div class="alert alert-info">{% if records == 1 %}Retrieved 1 result.{% else %}Retrieved {{ records }} results.{% endif %}</div>
|
<div class="alert alert-info">{% if records == 1 %}Retrieved 1 result.{% else %}Retrieved {{ records }} results.{% endif %}</div>
|
||||||
|
-->
|
||||||
{% if allow_filtering %}
|
{% if allow_filtering %}
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a class="btn{% if filtered %} active{% endif %}" href="index.php?mode=results&filtered=1">Filtered results</a>
|
<a class="btn{% if filtered %} active{% endif %}" href="index.php?mode=results&filtered=1">Filtered results</a>
|
||||||
@ -12,6 +14,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!--
|
||||||
<h2 id="statistics">Statistics</h2>
|
<h2 id="statistics">Statistics</h2>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -26,56 +29,52 @@
|
|||||||
{% for record in stats %}
|
{% for record in stats %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ loop.index }}.</td>
|
<td>{{ loop.index }}.</td>
|
||||||
{% if record.scene1.correct %}<td class="alert-success"><i class="icon-ok"></i>{% else %}<td class="alert-danger"><i class="icon-remove"></i>{% endif %} {{ record.scene1.time / 1000 }} seconds</td>
|
{% if record.scene1.correct %}<td class="alert-success"><i class="icon-ok"></i>{% else %}<td class="alert-danger"><i class="icon-remove"></i>{% endif %} {{ record.scene1.time }} ms</td>
|
||||||
{% if record.scene2.correct %}<td class="alert-success"><i class="icon-ok"></i>{% else %}<td class="alert-danger"><i class="icon-remove"></i>{% endif %} {{ record.scene2.time / 1000 }} seconds</td>
|
{% if record.scene2.correct %}<td class="alert-success"><i class="icon-ok"></i>{% else %}<td class="alert-danger"><i class="icon-remove"></i>{% endif %} {{ record.scene2.time }} ms</td>
|
||||||
{% if record.scene3.correct %}<td class="alert-success"><i class="icon-ok"></i>{% else %}<td class="alert-danger"><i class="icon-remove"></i>{% endif %} {{ record.scene3.time / 1000 }} seconds</td>
|
{% if record.scene3.correct %}<td class="alert-success"><i class="icon-ok"></i>{% else %}<td class="alert-danger"><i class="icon-remove"></i>{% endif %} {{ record.scene3.time }} ms</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
-->
|
||||||
<!--Doing some debugging.
|
|
||||||
<pre>{{ dump(stats) }}</pre>
|
|
||||||
<pre>{{ dump(debug) }}</pre> -->
|
|
||||||
|
|
||||||
<h2 id="raw-results">Raw results</h2>
|
<h2 id="raw-results">Raw results</h2>
|
||||||
<p><a class="btn" href="index.php?mode=result&download=1"><i class="icon-download-alt"></i> Download results</a></p>
|
<p><a class="btn" href="index.php?mode=results&download=1"><i class="icon-download-alt"></i> Download results</a></p>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
{% for record in data %}
|
||||||
|
<pre>{{dump(record.uid)}}</pre>
|
||||||
|
<pre>{{record.uid}}</pre>
|
||||||
|
{% endfor %}
|
||||||
|
-->
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>uid</th>
|
||||||
<th colspan="3">Notable</th>
|
<th>date</th>
|
||||||
<th colspan="3">Unnoted</th>
|
<th>host</th>
|
||||||
<th colspan="3">Renoted</th>
|
<th>phase</th>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>x</th>
|
|
||||||
<th>y</th>
|
|
||||||
<th>time</th>
|
|
||||||
<th>x</th>
|
|
||||||
<th>y</th>
|
|
||||||
<th>time</th>
|
|
||||||
<th>x</th>
|
<th>x</th>
|
||||||
<th>y</th>
|
<th>y</th>
|
||||||
<th>time</th>
|
<th>time</th>
|
||||||
|
<th>score</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for record in data %}
|
{% for record in data %}
|
||||||
<tr class="{% if record.result.host == '192.168.0.1' %}muted{% endif %}">
|
<tr class="{% if record.result.host == '192.168.0.1' %}muted{% endif %}">
|
||||||
<td>{{ loop.index }}.</td>
|
<td>{{record.uid}}.</td>
|
||||||
<td>{{ record.notable.xcoordinate }}</td>
|
<td>{{ record.datetime }}</td>
|
||||||
<td>{{ record.notable.ycoordinate }}</td>
|
<td>{{ record.host }}</td>
|
||||||
<td>{{ record.notable.responsetime }}</td>
|
<td>{{ record.phase }}</td>
|
||||||
<td>{{ record.unnoted.xcoordinate }}</td>
|
<td>{{ record.xcoordinate }}</td>
|
||||||
<td>{{ record.unnoted.ycoordinate }}</td>
|
<td>{{ record.ycoordinate }}</td>
|
||||||
<td>{{ record.unnoted.responsetime }}</td>
|
<td>{{ record.responsetime }}</td>
|
||||||
<td>{{ record.renoted.xcoordinate }}</td>
|
<td>{{ record.score }}</td>
|
||||||
<td>{{ record.renoted.ycoordinate }}</td>
|
|
||||||
<td>{{ record.renoted.responsetime }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,5 +1,4 @@
|
|||||||
notable unnoted renoted
|
uid datetime host phase xcoordinate ycoordinate responsetime score
|
||||||
x y time x y time x y time
|
{% for record in data %}
|
||||||
{% for result in data %}
|
{{record.uid}} {{record.datetime}} {{record.host}} {{record.phase}} {{record.xcoordinate}} {{record.ycoordinate}} {{record.responsetime}} {{record.score}}
|
||||||
{{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}}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Reference in New Issue
Block a user