Added code to update test results

This commit is contained in:
Gregory Ballantine 2024-06-03 14:18:34 -04:00
parent 5a79baca7d
commit 3309d3e2ca
3 changed files with 31 additions and 17 deletions

View File

@ -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)
)

View File

@ -41,6 +41,7 @@ class Test extends Model {
}
$data[$i] = [
'benchmark_id' => $b->id,
'name' => $b->name,
'scoring' => $b->scoring,
'count' => count($benchmarkResults),
@ -50,6 +51,7 @@ class Test extends Model {
];
} else {
$data[$i] = [
'benchmark_id' => $b->id,
'name' => $b->name,
'scoring' => $b->scoring,
'count' => count($benchmarkResults),

View File

@ -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>