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 benchmark_id: benchmarkId benchmarkRes = await fetch("/api/v1/benchmark/details?#{benchmarkSearchParams}") benchmarkData = await benchmarkRes.json() resultSearchParams = new URLSearchParams test_id: testId benchmark_id: benchmarkId resultRes = await fetch("/api/v1/result/list?#{resultSearchParams}") resultData = await resultRes.json() avg_total = 0 min_total = 0 max_total = 0 for result in resultData avg_total += result.avgScore min_total += result.minScore if result.minScore max_total += result.maxScore if result.maxScore tableRow = $("#results-table tr[data-benchmark-id=#{benchmarkId}]") tableRow.empty() tableRow.append('