Added ability to add benchmark results to a test
This commit is contained in:
@ -1,5 +1,18 @@
|
||||
testId = $('#results-table').data('test-id')
|
||||
|
||||
$ ->
|
||||
$('#test-result-form').on 'submit', (e) ->
|
||||
e.preventDefault()
|
||||
|
||||
form = $(this)
|
||||
formData = $(this).serialize()
|
||||
benchmarkId = $(this).find('[name="result_benchmark"]').val()
|
||||
|
||||
$.post '/api/v1/result/add', formData, (response) ->
|
||||
if response == 'success'
|
||||
fetchTestBenchmarkResults(testId, benchmarkId)
|
||||
form[0].reset()
|
||||
|
||||
fetchTestBenchmarkResults = (testId, benchmarkId) ->
|
||||
try
|
||||
benchmarkSearchParams = new URLSearchParams
|
||||
@ -18,12 +31,14 @@ fetchTestBenchmarkResults = (testId, benchmarkId) ->
|
||||
max_total = 0
|
||||
|
||||
for result in resultData
|
||||
avg_total += result.avg_score
|
||||
min_total += result.min_score
|
||||
max_total += result.max_score
|
||||
avg_total += result.avgScore
|
||||
min_total += result.minScore
|
||||
max_total += result.maxScore
|
||||
|
||||
tableRow = $("#results-table tr[data-benchmark-id=#{benchmarkId}]")
|
||||
|
||||
tableRow.empty()
|
||||
|
||||
tableRow.append('<td>' + benchmarkData.name + '</td>')
|
||||
tableRow.append('<td>' + benchmarkData.scoring + '</td>')
|
||||
tableRow.append('<td>' + resultData.length + '</td>')
|
||||
|
Reference in New Issue
Block a user