Added code to update test results
This commit is contained in:
parent
5a79baca7d
commit
3309d3e2ca
@ -32,5 +32,17 @@ addResult = (e) ->
|
|||||||
result_min: $('#result_min').val()
|
result_min: $('#result_min').val()
|
||||||
result_max: $('#result_max').val()
|
result_max: $('#result_max').val()
|
||||||
}, (data) ->
|
}, (data) ->
|
||||||
console.log(data)
|
dataRow = $('tr[data-benchmark=' + $('#result_benchmark').val() + ']')
|
||||||
|
numResultsElem = dataRow.children('[data-result-count]').eq(0)
|
||||||
|
numResults = numResultsElem.text()
|
||||||
|
avgElem = dataRow.children('[data-result-avg]').eq(0)
|
||||||
|
avgElem.text(((avgElem.text() * numResults) + $('#result_avg').val()) / (numResults + 1))
|
||||||
|
|
||||||
|
minElem = dataRow.children('[data-result-min]').eq(0)
|
||||||
|
minElem.text(((minElem.text() * numResults) + $('#result_min').val()) / (numResults + 1))
|
||||||
|
|
||||||
|
maxElem = dataRow.children('[data-result-max]').eq(0)
|
||||||
|
maxElem.text(((maxElem.text() * numResults) + $('#result_max').val()) / (numResults + 1))
|
||||||
|
|
||||||
|
numResultsElem.text(numResults + 1)
|
||||||
)
|
)
|
||||||
|
@ -41,6 +41,7 @@ class Test extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data[$i] = [
|
$data[$i] = [
|
||||||
|
'benchmark_id' => $b->id,
|
||||||
'name' => $b->name,
|
'name' => $b->name,
|
||||||
'scoring' => $b->scoring,
|
'scoring' => $b->scoring,
|
||||||
'count' => count($benchmarkResults),
|
'count' => count($benchmarkResults),
|
||||||
@ -50,6 +51,7 @@ class Test extends Model {
|
|||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$data[$i] = [
|
$data[$i] = [
|
||||||
|
'benchmark_id' => $b->id,
|
||||||
'name' => $b->name,
|
'name' => $b->name,
|
||||||
'scoring' => $b->scoring,
|
'scoring' => $b->scoring,
|
||||||
'count' => count($benchmarkResults),
|
'count' => count($benchmarkResults),
|
||||||
|
@ -64,13 +64,13 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for r in test.benchmarkResults() %}
|
{% for r in test.benchmarkResults() %}
|
||||||
<tr>
|
<tr data-benchmark="{{ r.benchmark_id }}">
|
||||||
<td>{{ r.name }}</td>
|
<td>{{ r.name }}</td>
|
||||||
<td>{{ r.scoring | capitalize }}</td>
|
<td>{{ r.scoring | capitalize }}</td>
|
||||||
<td>{{ r.count }}</td>
|
<td>{{ r.count }}</td>
|
||||||
<td>{{ r.average }}</td>
|
<td data-result-avg>{{ r.average }}</td>
|
||||||
<td>{{ r.minimum ? r.minimum : 'N/a' }}</td>
|
<td data-result-min>{{ r.minimum ? r.minimum : 'N/a' }}</td>
|
||||||
<td>{{ r.maximum ? r.maximum : 'N/a' }}</td>
|
<td data-result-max>{{ r.maximum ? r.maximum : 'N/a' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
Reference in New Issue
Block a user