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_max: $('#result_max').val()
|
||||
}, (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,21 +41,23 @@ class Test extends Model {
|
||||
}
|
||||
|
||||
$data[$i] = [
|
||||
'name' => $b->name,
|
||||
'scoring' => $b->scoring,
|
||||
'count' => count($benchmarkResults),
|
||||
'average' => (array_sum($averageResults) / count($averageResults)),
|
||||
'minimum' => (array_sum($minimumResults) / count($minimumResults)),
|
||||
'maximum' => (array_sum($maximumResults) / count($maximumResults)),
|
||||
'benchmark_id' => $b->id,
|
||||
'name' => $b->name,
|
||||
'scoring' => $b->scoring,
|
||||
'count' => count($benchmarkResults),
|
||||
'average' => (array_sum($averageResults) / count($averageResults)),
|
||||
'minimum' => (array_sum($minimumResults) / count($minimumResults)),
|
||||
'maximum' => (array_sum($maximumResults) / count($maximumResults)),
|
||||
];
|
||||
} else {
|
||||
$data[$i] = [
|
||||
'name' => $b->name,
|
||||
'scoring' => $b->scoring,
|
||||
'count' => count($benchmarkResults),
|
||||
'average' => 0,
|
||||
'minimum' => 0,
|
||||
'maximum' => 0,
|
||||
'benchmark_id' => $b->id,
|
||||
'name' => $b->name,
|
||||
'scoring' => $b->scoring,
|
||||
'count' => count($benchmarkResults),
|
||||
'average' => 0,
|
||||
'minimum' => 0,
|
||||
'maximum' => 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -64,13 +64,13 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in test.benchmarkResults() %}
|
||||
<tr>
|
||||
<tr data-benchmark="{{ r.benchmark_id }}">
|
||||
<td>{{ r.name }}</td>
|
||||
<td>{{ r.scoring | capitalize }}</td>
|
||||
<td>{{ r.count }}</td>
|
||||
<td>{{ r.average }}</td>
|
||||
<td>{{ r.minimum ? r.minimum : 'N/a' }}</td>
|
||||
<td>{{ r.maximum ? r.maximum : 'N/a' }}</td>
|
||||
<td data-result-avg>{{ r.average }}</td>
|
||||
<td data-result-min>{{ r.minimum ? r.minimum : 'N/a' }}</td>
|
||||
<td data-result-max>{{ r.maximum ? r.maximum : 'N/a' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
Loading…
Reference in New Issue
Block a user